You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dist/test-out/ca3e369e-b853-4b8a-a768-4d0075c3d656/app.component.spec.mjs
● Test suite failed to run
Do not import `@jest/globals` outside of the Jest test environment
at node_modules/@jest/globals/build/index.js:11:7
Please provide the environment you discovered this bug in
No response
Anything else?
I'm not sure why this happens and if this is an issue with Spectator or Angular's builder. What the builder does is simply building the whole app then running Jest ESM by invoking a node process (code here), so why are we outside of the "Jest test environment"?
An easy fix might be using import.meta.jest instead of importing jest as mentioned in the Jest ESM documentation.
Do you want to create a pull request?
Yes
The text was updated successfully, but these errors were encountered:
Is this a regression?
No
Description
Hi,
The Angular team has already announced some time ago their transition to Jest here. We can already play with an experimental version.
I have noticed that it does not work with Spectator which may become an issue.
Please provide a link to a minimal reproduction of the bug
https://github.com/Tommy228/spectator-angular-builders-jest
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
No response
Anything else?
I'm not sure why this happens and if this is an issue with Spectator or Angular's builder. What the builder does is simply building the whole app then running Jest ESM by invoking a node process (code here), so why are we outside of the "Jest test environment"?
An easy fix might be using
import.meta.jest
instead of importingjest
as mentioned in the Jest ESM documentation.Do you want to create a pull request?
Yes
The text was updated successfully, but these errors were encountered: