-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Open
Copy link
Labels
area: @angular-devkit/build-angulardevkit/build-angular:jestfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Description
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous versionTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
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 error Do 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
import { jest } from '@jest/globals';
describe('test', () => {
beforeEach(() => {
jest.useFakeTimers();
});
});
Exception or Error
FAIL dist/test-out/4c1de1b8-6e3e-4b2a-add2-968166a278d8/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
Your Environment
Angular CLI: 18.2.9
Node: 22.10.0
Package Manager: npm 10.9.0
OS: win32 x64
Angular: 18.2.8
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1802.9
@angular-devkit/build-angular 18.2.9
@angular-devkit/core 18.2.9
@angular-devkit/schematics 18.2.9
@angular/cli 18.2.9
@schematics/angular 18.2.9
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
Anything else relevant?
No response
jonaskuske and michaellieberherr
Metadata
Metadata
Assignees
Labels
area: @angular-devkit/build-angulardevkit/build-angular:jestfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
@jest/globals
outside of the Jest test environment ngneat/spectator#639