-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): load zone ESM when running jest in ESM mode (#892)
Closes #751
- Loading branch information
Showing
21 changed files
with
15,404 additions
and
11,818 deletions.
There are no files selected for viewing
77 changes: 0 additions & 77 deletions
77
e2e/test-app-v10/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
e2e/test-app-v11/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
e2e/test-app-v9/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable jest/no-standalone-expect */ | ||
|
||
import { PlatformRef } from '@angular/core'; | ||
import { jest } from '@jest/globals'; | ||
|
||
const mockInitTestEnvironment = jest.fn(); | ||
const mockGetTestBed = jest.fn(() => { | ||
return { | ||
initTestEnvironment: mockInitTestEnvironment, | ||
}; | ||
}); | ||
jest.mock('@angular/core/testing', () => { | ||
return { | ||
getTestBed: mockGetTestBed, | ||
}; | ||
}); | ||
|
||
class BrowserDynamicTestingModuleStub {} | ||
const mockPlatformBrowserDynamicTesting = jest.fn(() => new PlatformRef()); | ||
jest.mock('@angular/platform-browser-dynamic/testing', () => { | ||
return { | ||
BrowserDynamicTestingModule: new BrowserDynamicTestingModuleStub(), | ||
platformBrowserDynamicTesting: mockPlatformBrowserDynamicTesting, | ||
}; | ||
}); | ||
|
||
const shouldTest = !process.execArgv.includes('--experimental-vm-modules') ? test : test.skip; | ||
shouldTest('should initialize test environment with getTestBed() and initTestEnvironment()', async () => { | ||
// @ts-expect-error testing purpose | ||
await import('../config/setup-jest'); | ||
|
||
expect(mockGetTestBed).toHaveBeenCalled(); | ||
expect(mockInitTestEnvironment).toHaveBeenCalled(); | ||
expect(mockInitTestEnvironment.mock.calls[0][0]).toBeInstanceOf(BrowserDynamicTestingModuleStub); | ||
expect(mockPlatformBrowserDynamicTesting).toHaveBeenCalled(); | ||
expect(mockPlatformBrowserDynamicTesting.mock.results[0].value).toBeInstanceOf(PlatformRef); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext" | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"importHelpers": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.