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

5 lines
113 B
JavaScript
Raw Normal View History

feat: add basic jest support (#35080) PR Close #35080
2020-02-01 00:08:40 +09:00
module.exports = {
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
setupFilesAfterEnv: ['./jest-zone.js'],
testEnvironment: './zone-jsdom-environment.js'
feat: add basic jest support (#35080) PR Close #35080
2020-02-01 00:08:40 +09:00
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.1 Page: 128ms Template: 1ms
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