mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: use node test runner (#11574)
This commit is contained in:
parent
613f7162d7
commit
16becdbc3b
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -427,7 +427,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm run unit -w puppeteer-core -w puppeteer --if-present
|
npm run unit -w puppeteer-core -w puppeteer --if-present
|
||||||
|
|
||||||
ng-schematics-tests:
|
ng-schematics-unit:
|
||||||
name: '[Required] Angular Schematics tests'
|
name: '[Required] Angular Schematics tests'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-changes
|
needs: check-changes
|
||||||
@ -445,7 +445,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PUPPETEER_SKIP_DOWNLOAD: true
|
PUPPETEER_SKIP_DOWNLOAD: true
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm run test --workspace @puppeteer/ng-schematics
|
run: npm run unit --workspace @puppeteer/ng-schematics
|
||||||
|
|
||||||
ng-schematics-smoke-tests:
|
ng-schematics-smoke-tests:
|
||||||
name: Angular Schematics smoke tests on ${{ matrix.os }}
|
name: Angular Schematics smoke tests on ${{ matrix.os }}
|
||||||
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -10788,9 +10788,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "^17.0.7",
|
"@angular/cli": "^17.0.7",
|
||||||
"@schematics/angular": "^17.0.7",
|
"@schematics/angular": "^17.0.7"
|
||||||
"@types/node": "^16.18.61",
|
|
||||||
"rxjs": "7.8.1"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.13.2"
|
"node": ">=16.13.2"
|
||||||
@ -10903,12 +10901,6 @@
|
|||||||
"yarn": ">= 1.13.0"
|
"yarn": ">= 1.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/ng-schematics/node_modules/@types/node": {
|
|
||||||
"version": "16.18.68",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.68.tgz",
|
|
||||||
"integrity": "sha512-sG3hPIQwJLoewrN7cr0dwEy+yF5nD4D/4FxtQpFciRD/xwUzgD+G05uxZHv5mhfXo4F9Jkp13jjn0CC2q325sg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"packages/ng-schematics/node_modules/ajv": {
|
"packages/ng-schematics/node_modules/ajv": {
|
||||||
"version": "8.12.0",
|
"version": "8.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
|
|
||||||
export const testChromeBuildId = '113.0.5672.0';
|
export const testChromeBuildId = '113.0.5672.0';
|
||||||
export const testChromiumBuildId = '1083080';
|
export const testChromiumBuildId = '1083080';
|
||||||
export const testFirefoxBuildId = '122.0a1';
|
export const testFirefoxBuildId = '123.0a1';
|
||||||
export const testChromeDriverBuildId = '115.0.5763.0';
|
export const testChromeDriverBuildId = '115.0.5763.0';
|
||||||
export const testChromeHeadlessShellBuildId = '118.0.5950.0';
|
export const testChromeHeadlessShellBuildId = '118.0.5950.0';
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
"clean": "../../tools/clean.js",
|
"clean": "../../tools/clean.js",
|
||||||
"dev:test": "npm run test --watch",
|
"dev:test": "npm run test --watch",
|
||||||
"dev": "npm run build --watch",
|
"dev": "npm run build --watch",
|
||||||
"test": "wireit"
|
"unit": "wireit"
|
||||||
},
|
},
|
||||||
"wireit": {
|
"wireit": {
|
||||||
"build": {
|
"build": {
|
||||||
"command": "tsc -b && node tools/copySchemaFiles.js",
|
"command": "tsc -b && node tools/copySchemaFiles.mjs",
|
||||||
"clean": "if-file-deleted",
|
"clean": "if-file-deleted",
|
||||||
"files": [
|
"files": [
|
||||||
"tsconfig.json",
|
"tsconfig.json",
|
||||||
"tsconfig.spec.json",
|
"tsconfig.test.json",
|
||||||
"src/**",
|
"src/**",
|
||||||
"test/src/**"
|
"test/src/**"
|
||||||
],
|
],
|
||||||
@ -25,8 +25,8 @@
|
|||||||
"*.tsbuildinfo"
|
"*.tsbuildinfo"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"test": {
|
"unit": {
|
||||||
"command": "mocha",
|
"command": "node --test --test-reporter spec test/build",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"build"
|
"build"
|
||||||
]
|
]
|
||||||
@ -52,10 +52,8 @@
|
|||||||
"@angular-devkit/schematics": "^17.0.7"
|
"@angular-devkit/schematics": "^17.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.18.61",
|
|
||||||
"@schematics/angular": "^17.0.7",
|
"@schematics/angular": "^17.0.7",
|
||||||
"@angular/cli": "^17.0.7",
|
"@angular/cli": "^17.0.7"
|
||||||
"rxjs": "7.8.1"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -6,18 +8,18 @@ import {
|
|||||||
setupHttpHooks,
|
setupHttpHooks,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
describe('@puppeteer/ng-schematics: config', () => {
|
void describe('@puppeteer/ng-schematics: config', () => {
|
||||||
setupHttpHooks();
|
setupHttpHooks();
|
||||||
|
|
||||||
describe('Single Project', () => {
|
void describe('Single Project', () => {
|
||||||
it('should create default file', async () => {
|
void it('should create default file', async () => {
|
||||||
const tree = await buildTestingTree('config', 'single');
|
const tree = await buildTestingTree('config', 'single');
|
||||||
expect(tree.files).toContain('/.puppeteerrc.mjs');
|
expect(tree.files).toContain('/.puppeteerrc.mjs');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Multi projects', () => {
|
void describe('Multi projects', () => {
|
||||||
it('should create default file', async () => {
|
void it('should create default file', async () => {
|
||||||
const tree = await buildTestingTree('config', 'multi');
|
const tree = await buildTestingTree('config', 'multi');
|
||||||
expect(tree.files).toContain('/.puppeteerrc.mjs');
|
expect(tree.files).toContain('/.puppeteerrc.mjs');
|
||||||
expect(tree.files).not.toContain(
|
expect(tree.files).not.toContain(
|
@ -1,3 +1,5 @@
|
|||||||
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -6,11 +8,11 @@ import {
|
|||||||
setupHttpHooks,
|
setupHttpHooks,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
describe('@puppeteer/ng-schematics: e2e', () => {
|
void describe('@puppeteer/ng-schematics: e2e', () => {
|
||||||
setupHttpHooks();
|
setupHttpHooks();
|
||||||
|
|
||||||
describe('Single Project', () => {
|
void describe('Single Project', () => {
|
||||||
it('should create default file', async () => {
|
void it('should create default file', async () => {
|
||||||
const tree = await buildTestingTree('e2e', 'single', {
|
const tree = await buildTestingTree('e2e', 'single', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
});
|
});
|
||||||
@ -18,7 +20,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
expect(tree.files).not.toContain('/e2e/tests/my-test.test.ts');
|
expect(tree.files).not.toContain('/e2e/tests/my-test.test.ts');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create Node file', async () => {
|
void it('should create Node file', async () => {
|
||||||
const tree = await buildTestingTree('e2e', 'single', {
|
const tree = await buildTestingTree('e2e', 'single', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
testRunner: 'node',
|
testRunner: 'node',
|
||||||
@ -27,7 +29,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
expect(tree.files).toContain('/e2e/tests/my-test.test.ts');
|
expect(tree.files).toContain('/e2e/tests/my-test.test.ts');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create file with route', async () => {
|
void it('should create file with route', async () => {
|
||||||
const route = 'home';
|
const route = 'home';
|
||||||
const tree = await buildTestingTree('e2e', 'single', {
|
const tree = await buildTestingTree('e2e', 'single', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
@ -39,7 +41,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create with route with starting slash', async () => {
|
void it('should create with route with starting slash', async () => {
|
||||||
const route = '/home';
|
const route = '/home';
|
||||||
const tree = await buildTestingTree('e2e', 'single', {
|
const tree = await buildTestingTree('e2e', 'single', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
@ -52,8 +54,8 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Multi projects', () => {
|
void describe('Multi projects', () => {
|
||||||
it('should create default file', async () => {
|
void it('should create default file', async () => {
|
||||||
const tree = await buildTestingTree('e2e', 'multi', {
|
const tree = await buildTestingTree('e2e', 'multi', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
});
|
});
|
||||||
@ -65,7 +67,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create Node file', async () => {
|
void it('should create Node file', async () => {
|
||||||
const tree = await buildTestingTree('e2e', 'multi', {
|
const tree = await buildTestingTree('e2e', 'multi', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
testRunner: 'node',
|
testRunner: 'node',
|
||||||
@ -78,7 +80,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create file with route', async () => {
|
void it('should create file with route', async () => {
|
||||||
const route = 'home';
|
const route = 'home';
|
||||||
const tree = await buildTestingTree('e2e', 'multi', {
|
const tree = await buildTestingTree('e2e', 'multi', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
||||||
@ -92,7 +94,7 @@ describe('@puppeteer/ng-schematics: e2e', () => {
|
|||||||
).toContain(`setupBrowserHooks('${route}');`);
|
).toContain(`setupBrowserHooks('${route}');`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create with route with starting slash', async () => {
|
void it('should create with route with starting slash', async () => {
|
||||||
const route = '/home';
|
const route = '/home';
|
||||||
const tree = await buildTestingTree('e2e', 'multi', {
|
const tree = await buildTestingTree('e2e', 'multi', {
|
||||||
name: 'myTest',
|
name: 'myTest',
|
@ -1,3 +1,5 @@
|
|||||||
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -11,11 +13,11 @@ import {
|
|||||||
setupHttpHooks,
|
setupHttpHooks,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
describe('@puppeteer/ng-schematics: ng-add', () => {
|
void describe('@puppeteer/ng-schematics: ng-add', () => {
|
||||||
setupHttpHooks();
|
setupHttpHooks();
|
||||||
|
|
||||||
describe('Single Project', () => {
|
void describe('Single Project', () => {
|
||||||
it('should create base files and update to "package.json"', async () => {
|
void it('should create base files and update to "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add');
|
const tree = await buildTestingTree('ng-add');
|
||||||
const {devDependencies, scripts} = getPackageJson(tree);
|
const {devDependencies, scripts} = getPackageJson(tree);
|
||||||
const {builder, configurations} = getAngularJsonScripts(tree);
|
const {builder, configurations} = getAngularJsonScripts(tree);
|
||||||
@ -32,7 +34,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should update create proper "ng" command for non default tester', async () => {
|
void it('should update create proper "ng" command for non default tester', async () => {
|
||||||
let tree = await buildTestingTree('ng-add', 'single');
|
let tree = await buildTestingTree('ng-add', 'single');
|
||||||
// Re-run schematic to have e2e populated
|
// Re-run schematic to have e2e populated
|
||||||
tree = await runSchematic(tree, 'ng-add');
|
tree = await runSchematic(tree, 'ng-add');
|
||||||
@ -42,12 +44,12 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(scripts['puppeteer']).toBe('ng run sandbox:puppeteer');
|
expect(scripts['puppeteer']).toBe('ng run sandbox:puppeteer');
|
||||||
expect(builder).toBe('@puppeteer/ng-schematics:puppeteer');
|
expect(builder).toBe('@puppeteer/ng-schematics:puppeteer');
|
||||||
});
|
});
|
||||||
it('should not create Puppeteer config', async () => {
|
void it('should not create Puppeteer config', async () => {
|
||||||
const {files} = await buildTestingTree('ng-add', 'single');
|
const {files} = await buildTestingTree('ng-add', 'single');
|
||||||
|
|
||||||
expect(files).not.toContain('/.puppeteerrc.cjs');
|
expect(files).not.toContain('/.puppeteerrc.cjs');
|
||||||
});
|
});
|
||||||
it('should create Jasmine files and update "package.json"', async () => {
|
void it('should create Jasmine files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'single', {
|
const tree = await buildTestingTree('ng-add', 'single', {
|
||||||
testRunner: 'jasmine',
|
testRunner: 'jasmine',
|
||||||
});
|
});
|
||||||
@ -58,7 +60,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('jasmine');
|
expect(devDependencies).toContain('jasmine');
|
||||||
expect(options['testRunner']).toBe('jasmine');
|
expect(options['testRunner']).toBe('jasmine');
|
||||||
});
|
});
|
||||||
it('should create Jest files and update "package.json"', async () => {
|
void it('should create Jest files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'single', {
|
const tree = await buildTestingTree('ng-add', 'single', {
|
||||||
testRunner: 'jest',
|
testRunner: 'jest',
|
||||||
});
|
});
|
||||||
@ -70,7 +72,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('@types/jest');
|
expect(devDependencies).toContain('@types/jest');
|
||||||
expect(options['testRunner']).toBe('jest');
|
expect(options['testRunner']).toBe('jest');
|
||||||
});
|
});
|
||||||
it('should create Mocha files and update "package.json"', async () => {
|
void it('should create Mocha files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'single', {
|
const tree = await buildTestingTree('ng-add', 'single', {
|
||||||
testRunner: 'mocha',
|
testRunner: 'mocha',
|
||||||
});
|
});
|
||||||
@ -82,7 +84,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('@types/mocha');
|
expect(devDependencies).toContain('@types/mocha');
|
||||||
expect(options['testRunner']).toBe('mocha');
|
expect(options['testRunner']).toBe('mocha');
|
||||||
});
|
});
|
||||||
it('should create Node files', async () => {
|
void it('should create Node files', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'single', {
|
const tree = await buildTestingTree('ng-add', 'single', {
|
||||||
testRunner: 'node',
|
testRunner: 'node',
|
||||||
});
|
});
|
||||||
@ -93,7 +95,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(tree.files).toContain('/e2e/tests/app.test.ts');
|
expect(tree.files).toContain('/e2e/tests/app.test.ts');
|
||||||
expect(options['testRunner']).toBe('node');
|
expect(options['testRunner']).toBe('node');
|
||||||
});
|
});
|
||||||
it('should create TypeScript files', async () => {
|
void it('should create TypeScript files', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'single');
|
const tree = await buildTestingTree('ng-add', 'single');
|
||||||
const tsConfigPath = '/e2e/tsconfig.json';
|
const tsConfigPath = '/e2e/tsconfig.json';
|
||||||
const tsConfig = tree.readJson(tsConfigPath);
|
const tsConfig = tree.readJson(tsConfigPath);
|
||||||
@ -106,7 +108,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should not create port value', async () => {
|
void it('should not create port value', async () => {
|
||||||
const tree = await buildTestingTree('ng-add');
|
const tree = await buildTestingTree('ng-add');
|
||||||
|
|
||||||
const {options} = getAngularJsonScripts(tree);
|
const {options} = getAngularJsonScripts(tree);
|
||||||
@ -114,8 +116,8 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Multi projects Application', () => {
|
void describe('Multi projects Application', () => {
|
||||||
it('should create base files and update to "package.json"', async () => {
|
void it('should create base files and update to "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi');
|
const tree = await buildTestingTree('ng-add', 'multi');
|
||||||
const {devDependencies, scripts} = getPackageJson(tree);
|
const {devDependencies, scripts} = getPackageJson(tree);
|
||||||
const {builder, configurations} = getAngularJsonScripts(tree);
|
const {builder, configurations} = getAngularJsonScripts(tree);
|
||||||
@ -138,7 +140,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should update create proper "ng" command for non default tester', async () => {
|
void it('should update create proper "ng" command for non default tester', async () => {
|
||||||
let tree = await buildTestingTree('ng-add', 'multi');
|
let tree = await buildTestingTree('ng-add', 'multi');
|
||||||
// Re-run schematic to have e2e populated
|
// Re-run schematic to have e2e populated
|
||||||
tree = await runSchematic(tree, 'ng-add');
|
tree = await runSchematic(tree, 'ng-add');
|
||||||
@ -148,13 +150,13 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(scripts['puppeteer']).toBe('ng run sandbox:puppeteer');
|
expect(scripts['puppeteer']).toBe('ng run sandbox:puppeteer');
|
||||||
expect(builder).toBe('@puppeteer/ng-schematics:puppeteer');
|
expect(builder).toBe('@puppeteer/ng-schematics:puppeteer');
|
||||||
});
|
});
|
||||||
it('should not create Puppeteer config', async () => {
|
void it('should not create Puppeteer config', async () => {
|
||||||
const {files} = await buildTestingTree('ng-add', 'multi');
|
const {files} = await buildTestingTree('ng-add', 'multi');
|
||||||
|
|
||||||
expect(files).not.toContain(getMultiApplicationFile('.puppeteerrc.cjs'));
|
expect(files).not.toContain(getMultiApplicationFile('.puppeteerrc.cjs'));
|
||||||
expect(files).not.toContain('/.puppeteerrc.cjs');
|
expect(files).not.toContain('/.puppeteerrc.cjs');
|
||||||
});
|
});
|
||||||
it('should create Jasmine files and update "package.json"', async () => {
|
void it('should create Jasmine files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi', {
|
const tree = await buildTestingTree('ng-add', 'multi', {
|
||||||
testRunner: 'jasmine',
|
testRunner: 'jasmine',
|
||||||
});
|
});
|
||||||
@ -165,7 +167,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('jasmine');
|
expect(devDependencies).toContain('jasmine');
|
||||||
expect(options['testRunner']).toBe('jasmine');
|
expect(options['testRunner']).toBe('jasmine');
|
||||||
});
|
});
|
||||||
it('should create Jest files and update "package.json"', async () => {
|
void it('should create Jest files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi', {
|
const tree = await buildTestingTree('ng-add', 'multi', {
|
||||||
testRunner: 'jest',
|
testRunner: 'jest',
|
||||||
});
|
});
|
||||||
@ -179,7 +181,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('@types/jest');
|
expect(devDependencies).toContain('@types/jest');
|
||||||
expect(options['testRunner']).toBe('jest');
|
expect(options['testRunner']).toBe('jest');
|
||||||
});
|
});
|
||||||
it('should create Mocha files and update "package.json"', async () => {
|
void it('should create Mocha files and update "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi', {
|
const tree = await buildTestingTree('ng-add', 'multi', {
|
||||||
testRunner: 'mocha',
|
testRunner: 'mocha',
|
||||||
});
|
});
|
||||||
@ -191,7 +193,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(devDependencies).toContain('@types/mocha');
|
expect(devDependencies).toContain('@types/mocha');
|
||||||
expect(options['testRunner']).toBe('mocha');
|
expect(options['testRunner']).toBe('mocha');
|
||||||
});
|
});
|
||||||
it('should create Node files', async () => {
|
void it('should create Node files', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi', {
|
const tree = await buildTestingTree('ng-add', 'multi', {
|
||||||
testRunner: 'node',
|
testRunner: 'node',
|
||||||
});
|
});
|
||||||
@ -206,7 +208,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
);
|
);
|
||||||
expect(options['testRunner']).toBe('node');
|
expect(options['testRunner']).toBe('node');
|
||||||
});
|
});
|
||||||
it('should create TypeScript files', async () => {
|
void it('should create TypeScript files', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi');
|
const tree = await buildTestingTree('ng-add', 'multi');
|
||||||
const tsConfigPath = getMultiApplicationFile('e2e/tsconfig.json');
|
const tsConfigPath = getMultiApplicationFile('e2e/tsconfig.json');
|
||||||
const tsConfig = tree.readJson(tsConfigPath);
|
const tsConfig = tree.readJson(tsConfigPath);
|
||||||
@ -219,7 +221,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should not create port value', async () => {
|
void it('should not create port value', async () => {
|
||||||
const tree = await buildTestingTree('ng-add');
|
const tree = await buildTestingTree('ng-add');
|
||||||
|
|
||||||
const {options} = getAngularJsonScripts(tree);
|
const {options} = getAngularJsonScripts(tree);
|
||||||
@ -227,8 +229,8 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Multi projects Library', () => {
|
void describe('Multi projects Library', () => {
|
||||||
it('should create base files and update to "package.json"', async () => {
|
void it('should create base files and update to "package.json"', async () => {
|
||||||
const tree = await buildTestingTree('ng-add', 'multi');
|
const tree = await buildTestingTree('ng-add', 'multi');
|
||||||
const config = getAngularJsonScripts(
|
const config = getAngularJsonScripts(
|
||||||
tree,
|
tree,
|
||||||
@ -248,7 +250,7 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
expect(config).toBeUndefined();
|
expect(config).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create Puppeteer config', async () => {
|
void it('should not create Puppeteer config', async () => {
|
||||||
const {files} = await buildTestingTree('ng-add', 'multi');
|
const {files} = await buildTestingTree('ng-add', 'multi');
|
||||||
|
|
||||||
expect(files).not.toContain(getMultiLibraryFile('.puppeteerrc.cjs'));
|
expect(files).not.toContain(getMultiLibraryFile('.puppeteerrc.cjs'));
|
@ -1,4 +1,5 @@
|
|||||||
import https from 'https';
|
import https from 'https';
|
||||||
|
import {before, after} from 'node:test';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import type {JsonObject} from '@angular-devkit/core';
|
import type {JsonObject} from '@angular-devkit/core';
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs = require('fs/promises');
|
import fs from 'fs/promises';
|
||||||
const {join} = require('path');
|
import path from 'path';
|
||||||
const path = require('path');
|
import url from 'url';
|
||||||
|
|
||||||
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -44,8 +46,8 @@ async function findSchemaFiles(directory, files = []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function copySchemaFiles() {
|
async function copySchemaFiles() {
|
||||||
const srcDir = join(__dirname, '..', 'src');
|
const srcDir = path.join(__dirname, '..', 'src');
|
||||||
const outputDir = join(__dirname, '..', 'lib');
|
const outputDir = path.join(__dirname, '..', 'lib');
|
||||||
const files = await findSchemaFiles(srcDir);
|
const files = await findSchemaFiles(srcDir);
|
||||||
|
|
||||||
const moves = files.map(file => {
|
const moves = files.map(file => {
|
@ -14,5 +14,5 @@
|
|||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["src/**/files/**/*"],
|
"exclude": ["src/**/files/**/*"],
|
||||||
"references": [{"path": "./tsconfig.spec.json"}]
|
"references": [{"path": "./tsconfig.test.json"}]
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "test/src/",
|
"rootDir": "test/src/",
|
||||||
"outDir": "test/build/",
|
"outDir": "test/build/",
|
||||||
"types": ["node", "mocha"]
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"include": ["test/src/**/*"],
|
"include": ["test/src/**/*"],
|
||||||
"exclude": ["test/build/**/*"]
|
"exclude": ["test/build/**/*"]
|
Loading…
Reference in New Issue
Block a user