angular/packages/zone.js/test/jest/zone-node-environment.js
JiaLiPassion 59aa2c06d1 test(zone.js): update jest test code after upgrade to jest 29.0 (#47486)
related to https://github.com/angular/angular/pull/47438
After jest 28, `jest-environment-node` and `jest-environment-jsdom` need
to be installed by the user themselves, and the API has some breaking
changes, so this PR fix these issues to make the zone/jest integration
test code work as expected.

PR Close #47486
2022-09-20 18:12:47 +02:00

23 lines
514 B
JavaScript

const NodeEnvironment = require('jest-environment-node').default;
const exportFakeTimersToSandboxGlobal = require('./jest-zone-patch-fake-timer');
class ZoneNodeEnvironment extends NodeEnvironment {
constructor(config, context) {
super(config, context);
exportFakeTimersToSandboxGlobal(this);
}
async setup() {
await super.setup();
}
async teardown() {
await super.teardown();
}
runScript(script) {
return super.runScript(script);
}
}
module.exports = ZoneNodeEnvironment;