angular-cn/packages/zone.js/test
JiaLiPassion 4374931b0e fix(zone.js): zone.js patch jest should handle done correctly (#36022)
`zone.js` supports jest `test.each()` methods, but it
introduces a bug, which is the `done()` function will not be handled correctly.

```
it('should work with done', done => {
  // done will be undefined.
});
```

The reason is the logic of monkey patching `test` method is different from `jasmine` patch

// jasmine patch
```
return testBody.length === 0
   ? () => testProxyZone.run(testBody, null)
   : done => testProxyZone.run(testBody, null, [done]);
```

// jest patch
```
 return function(...args) {
   return testProxyZone.run(testBody, null, args);
 };
```

the purpose of this change is to handle the following cases.

```
test.each([1, 2])('test.each', (arg1, arg2) => {
  expect(arg1).toBe(1);
  expect(arg2).toBe(2);
});
```

so in jest, it is a little complex, because the `testBody`'s parameter may be bigger than 1, so the
logic in `jasmine`

```
return testBody.length === 0
   ? () => testProxyZone.run(testBody, null)
   : done => testProxyZone.run(testBody, null, [done]);
```
will not work for `test.each` in jest.

So in this PR, I created a dynamic `Function` to return the correct length of paramters (which is required by jest core), to handle
1. normal `test` with or without `done`.
2. each with parameters with or without done.

PR Close #36022
2020-04-07 15:22:16 -07:00
..
assets
browser fix(zone.js): Make `EventTarget` methods optional in `zone.js` extension API (#35954) 2020-03-16 09:00:44 -07:00
closure fix(zone.js): __load_patch and __symbol__ should be in zone_extern for closure compiler (#31350) 2019-07-24 13:30:01 -07:00
common feat(zone.js): add a zone config to allow user disable wrapping uncaught promise rejection (#35873) 2020-03-16 09:00:10 -07:00
extra fix(zone.js): fix 2 bluebird test cases for each/mapSeries (#36295) 2020-03-31 10:59:56 -07:00
jest fix(zone.js): zone.js patch jest should handle done correctly (#36022) 2020-04-07 15:22:16 -07:00
node build: move zone.js to angular repo (#30962) 2019-06-20 11:27:39 -07:00
npm_package feat(zone.js): Monkey patch MessagePort.prototype onproperties (#34610) 2020-03-16 08:59:38 -07:00
patch
performance
promise refactor: cleanup zone.js test instruction (#34860) 2020-03-06 16:53:21 -05:00
rxjs fix(zone.js): zone.js patches rxjs should check null for unsubscribe (#35990) 2020-03-16 09:01:17 -07:00
webdriver
zone-spec fix(zone.js): `tickOptions`'s `processNewMacroTasksSynchronously` should default to true when flag omitted (#35814) 2020-03-06 17:33:57 -05:00
BUILD.bazel feat(zone.js): add a zone config to allow user disable wrapping uncaught promise rejection (#35873) 2020-03-16 09:00:10 -07:00
browser-env-setup.ts
browser-zone-setup.ts
browser_disable_wrap_uncaught_promise_rejection_entry_point.ts feat(zone.js): add a zone config to allow user disable wrapping uncaught promise rejection (#35873) 2020-03-16 09:00:10 -07:00
browser_disable_wrap_uncaught_promise_rejection_setup.ts feat(zone.js): add a zone config to allow user disable wrapping uncaught promise rejection (#35873) 2020-03-16 09:00:10 -07:00
browser_entry_point.ts feat(zone.js): Monkey patch MessagePort.prototype onproperties (#34610) 2020-03-16 08:59:38 -07:00
browser_es2015_entry_point.ts
browser_shadydom_entry_point.ts fix(zone.js): patch shadydom (#31717) 2019-07-24 14:42:14 -07:00
browser_shadydom_setup.ts fix(zone.js): patch shadydom (#31717) 2019-07-24 14:42:14 -07:00
browser_symbol_setup.ts
common_tests.ts
fake_entry.js
jasmine-patch.spec.ts
karma_test.bzl feat(zone.js): Monkey patch MessagePort.prototype onproperties (#34610) 2020-03-16 08:59:38 -07:00
main.ts
mocha-patch.spec.ts
node-env-setup.ts
node_bluebird_entry_point.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
node_entry_point.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
node_entry_point_no_patch_clock.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
node_error_disable_policy_entry_point.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
node_error_entry_point.ts
node_error_lazy_policy_entry_point.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
node_tests.ts
saucelabs.js
test-env-setup-jasmine-no-patch-clock.ts
test-env-setup-jasmine.ts
test-env-setup-mocha.ts
test-util.ts refactor: ensure zone.js can be built with typescript strict flag (#30993) 2019-07-18 14:21:26 -07:00
test_fake_polyfill.ts feat: add a temp solution to support passive event listeners. (#34503) 2020-02-24 17:30:04 -08:00
ws-client.js
ws-server.js
ws-webworker-context.ts
wtf_mock.ts
zone_worker_entry_point.ts