Logo
Explore Help
Sign In
iSharkFly-Docs/angular-docs-cn
1
0
Fork 0
You've already forked angular-docs-cn
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
angular-docs-cn/packages/zone.js/test/jest/jest.node.config.js

5 lines
112 B
JavaScript
Raw Normal View History

feat(zone.js): add jest fakeTimers support (#39016) Close #38851, support `jest` fakeTimers APIs' integration with `fakeAsync()`. After enable this feature, calling `jest.useFakeTimers()` will make all test run into `fakeAsync()` automatically. ``` beforeEach(() => { jest.useFakeTimers('modern'); }); afterEach(() => { jest.useRealTimers(); }); test('should run into fakeAsync() automatically', () => { const fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); expect(fakeAsyncZoneSpec).toBeTruthy(); }); ``` Also there are mappings between `jest` and `zone` APIs. - `jest.runAllTicks()` will call `flushMicrotasks()`. - `jest.runAllTimers()` will call `flush()`. - `jest.advanceTimersByTime()` will call `tick()` - `jest.runOnlyPendingTimers()` will call `flushOnlyPendingTimers()` - `jest.advanceTimersToNextTimer()` will call `tickToNext()` - `jest.clearAllTimers()` will call `removeAllTimers()` - `jest.getTimerCount()` will call `getTimerCount()` PR Close #39016
2020-09-22 22:52:20 +09:00
module.exports = {
setupFilesAfterEnv: ['./jest-zone.js'],
testEnvironment: './zone-node-environment.js'
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 122ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API