Tests using @angular-builders/jest cannot import jest object from @jest/globals #28722
Labels
area: @angular-devkit/build-angular
devkit/build-angular:jest
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Importing
jest
from@jest/globals
with the new test builder fails with the errorDo not import @jest/globals outside of the Jest test environment
.This isn't an issue when writing spec files as you can directly access it (probably thanks to this) or use
import.meta.jest
, however this breaks compatibility with third party libs such as Spectator.Minimal Reproduction
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: