10 Commits

Author SHA1 Message Date
JiaLiPassion
1cba56e11f refactor(core): remove unused fakeAsyncFallback and asyncFallback ()
`zone.js` 0.8.25 introduces `zone-testing` bundle and move all `fakeAsync/async` logic
from `@angular/core/testing` to `zone.js` package. But in case some user still using the old
version of `zone.js`, an old version of `fakeAsync/async` logic were still kept inside `@angular/core/testing`
package as `fallback` logic. Since now `Angular8+` already use `zone.js 0.9+`, so
those fallback logic is removed.

PR Close 
2020-11-20 08:34:59 -08:00
JiaLiPassion
82d54fe8c3 feat(zone.js): add jest fakeTimers support ()
Close , 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 
2020-10-05 13:23:17 -07:00
Joey Perrott
d1ea1f4c7f build: update license headers to reference Google LLC ()
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close 
2020-05-26 14:26:58 -04:00
Joey Perrott
698b0288be build: reformat repo to new clang@1.4.0 ()
PR Close 
2020-04-14 12:08:36 -07:00
JiaLiPassion
17b862cf82 feat: add an tickOptions parameter with property processNewMacroTasksSynchronously. ()
This option will control whether to invoke the new macro tasks when ticking.

Close 

PR Close 
2020-02-20 15:14:59 -08:00
JiaLiPassion
332937ef24 feat: make mocha a zone module. ()
PR Close 
2020-02-11 11:41:58 -08:00
JiaLiPassion
daac33cdc8 feat: add basic jest support ()
PR Close 
2020-02-07 11:43:21 -08:00
Danny Skoog
6ab5f3648a refactor: utilize type narrowing ()
PR Close 
2019-10-10 15:18:44 -07:00
Paul Gschwendtner
60f58bf051 refactor: ensure zone.js can be built with typescript strict flag ()
As part of FW-1265, the `zone.js` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close 
2019-07-18 14:21:26 -07:00
JiaLiPassion
5eb7426216 build: move zone.js to angular repo ()
PR Close 
2019-06-20 11:27:39 -07:00