From a833c403fc2c93c319e9d049724f98a388821133 Mon Sep 17 00:00:00 2001 From: MG Date: Sat, 24 Jul 2021 14:24:25 +0200 Subject: [PATCH] test(e2e): pure jest configuration #610 --- e2e/a-jest/jest.es2015ivy.js | 1 - e2e/a-jest/jest.es5ivy.js | 1 - e2e/a-jest/package-lock.json | 6 ------ e2e/a-jest/package.json | 1 - e2e/a-jest/src/app/app.component.spec.ts | 4 ++++ e2e/a-jest/src/setup-jest.ts | 7 ------- e2e/a-jest/tsconfig.json | 2 +- e2e/a-min/jest.es2015ivy.js | 1 - e2e/a-min/jest.es5ivy.js | 1 - 9 files changed, 5 insertions(+), 19 deletions(-) diff --git a/e2e/a-jest/jest.es2015ivy.js b/e2e/a-jest/jest.es2015ivy.js index b01738101f..09f057f597 100644 --- a/e2e/a-jest/jest.es2015ivy.js +++ b/e2e/a-jest/jest.es2015ivy.js @@ -1,6 +1,5 @@ module.exports = { preset: 'jest-preset-angular', - testRunner: 'jest-jasmine2', setupFilesAfterEnv: ['/src/setup-jest.ts'], testURL: 'http://localhost', testPathIgnorePatterns: ['/src/test.ts'], diff --git a/e2e/a-jest/jest.es5ivy.js b/e2e/a-jest/jest.es5ivy.js index 55ab2fce98..e07fcbad42 100644 --- a/e2e/a-jest/jest.es5ivy.js +++ b/e2e/a-jest/jest.es5ivy.js @@ -1,6 +1,5 @@ module.exports = { preset: 'jest-preset-angular', - testRunner: 'jest-jasmine2', setupFilesAfterEnv: ['/src/setup-jest.ts'], testURL: 'http://localhost', testPathIgnorePatterns: ['/src/test.ts'], diff --git a/e2e/a-jest/package-lock.json b/e2e/a-jest/package-lock.json index d3fd049634..e44e653b0f 100644 --- a/e2e/a-jest/package-lock.json +++ b/e2e/a-jest/package-lock.json @@ -5656,12 +5656,6 @@ "@types/istanbul-lib-report": "*" } }, - "@types/jasmine": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.8.1.tgz", - "integrity": "sha512-ioRNoJvv0eXL1c9BZKpnywZWb5YflhaSiF3IOp9deyoh30MOwkB3bNuzi4UW76EFEhcmqpoEpdWhcUAAilomTw==", - "dev": true - }, "@types/jest": { "version": "26.0.24", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz", diff --git a/e2e/a-jest/package.json b/e2e/a-jest/package.json index 3ed885c831..ba8f1c16ee 100644 --- a/e2e/a-jest/package.json +++ b/e2e/a-jest/package.json @@ -32,7 +32,6 @@ "@angular-devkit/build-angular": "12.1.3", "@angular/cli": "12.1.3", "@angular/compiler-cli": "12.1.3", - "@types/jasmine": "3.8.1", "@types/jest": "26.0.24", "@types/node": "14.17.6", "jest": "27.0.6", diff --git a/e2e/a-jest/src/app/app.component.spec.ts b/e2e/a-jest/src/app/app.component.spec.ts index 4e644de39d..2050b24fa9 100644 --- a/e2e/a-jest/src/app/app.component.spec.ts +++ b/e2e/a-jest/src/app/app.component.spec.ts @@ -14,6 +14,10 @@ ngMocks.defaultMock(AppService, () => ({ })); describe('app-component', () => { + // A fix until https://github.com/facebook/jest/issues/11483 has been merged. + MockInstance.scope('all'); + MockInstance.scope(); + const factory = MockRenderFactory(AppComponent, ['scope']); ngMocks.faster(); beforeAll(() => MockBuilder(AppComponent, AppModule)); diff --git a/e2e/a-jest/src/setup-jest.ts b/e2e/a-jest/src/setup-jest.ts index 10d86adc87..15a7dea022 100644 --- a/e2e/a-jest/src/setup-jest.ts +++ b/e2e/a-jest/src/setup-jest.ts @@ -3,10 +3,3 @@ import 'jest-preset-angular/setup-jest'; import { MockInstance, ngMocks } from 'ng-mocks'; ngMocks.autoSpy('jest'); - -jasmine.getEnv().addReporter({ - specDone: MockInstance.restore, - specStarted: MockInstance.remember, - suiteDone: MockInstance.restore, - suiteStarted: MockInstance.remember, -}); diff --git a/e2e/a-jest/tsconfig.json b/e2e/a-jest/tsconfig.json index ee8e17416d..2fb94097a6 100644 --- a/e2e/a-jest/tsconfig.json +++ b/e2e/a-jest/tsconfig.json @@ -18,7 +18,7 @@ "emitDecoratorMetadata": true, "esModuleInterop": true, "skipLibCheck": true, - "types": ["jasmine", "jest", "node"] + "types": ["jest", "node"] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, diff --git a/e2e/a-min/jest.es2015ivy.js b/e2e/a-min/jest.es2015ivy.js index b01738101f..09f057f597 100644 --- a/e2e/a-min/jest.es2015ivy.js +++ b/e2e/a-min/jest.es2015ivy.js @@ -1,6 +1,5 @@ module.exports = { preset: 'jest-preset-angular', - testRunner: 'jest-jasmine2', setupFilesAfterEnv: ['/src/setup-jest.ts'], testURL: 'http://localhost', testPathIgnorePatterns: ['/src/test.ts'], diff --git a/e2e/a-min/jest.es5ivy.js b/e2e/a-min/jest.es5ivy.js index 55ab2fce98..e07fcbad42 100644 --- a/e2e/a-min/jest.es5ivy.js +++ b/e2e/a-min/jest.es5ivy.js @@ -1,6 +1,5 @@ module.exports = { preset: 'jest-preset-angular', - testRunner: 'jest-jasmine2', setupFilesAfterEnv: ['/src/setup-jest.ts'], testURL: 'http://localhost', testPathIgnorePatterns: ['/src/test.ts'],