Commit Graph

113 Commits

Author SHA1 Message Date
Wagner Maciel ad8c4cdd75 revert: "feat(dev-infra): exposed new rule 'component_benchmark' via dev_infra (#36434)" (#36798)
This reverts commit b7f2a033df.

PR Close #36798
2020-04-24 11:03:38 -07:00
Wagner Maciel b7f2a033df feat(dev-infra): exposed new rule 'component_benchmark' via dev_infra (#36434)
* Move tools/brotli-cli, tools/browsers, tools/components,
  tools/ng_rollup_bundle, and modules/e2e_util to dev-infra/benchmarking
* Fix imports and references to moved folders and files
* Set up BUILD.bazel files for moved folders so they can be packaged with
  dev-infra's :npm_package

PR Close #36434
2020-04-23 13:31:53 -07:00
Joey Perrott 698b0288be build: reformat repo to new clang@1.4.0 (#36613)
PR Close #36613
2020-04-14 12:08:36 -07:00
JiaLiPassion 41667de778 fix(zone.js): add issue numbers of `@types/jasmine` to the test cases (#34625)
Some cases will still need to use `spy as any` cast, because `@types/jasmine` have some issues,
1. The issue jasmine doesn't handle optional method properties, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/43486
2. The issue jasmine doesn't handle overload method correctly, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42455

PR Close #34625
2020-04-08 12:10:34 -07:00
JiaLiPassion ef4736d052 build: update jasmine to 3.5 (#34625)
1. update jasmine to 3.5
2. update @types/jasmine to 3.5
3. update @types/jasminewd2 to 2.0.8

Also fix several cases, the new jasmine 3 will help to create test cases correctly,
such as in the `jasmine 2.x` version, the following case will pass

```
expect(1 == 2);
```

But in jsamine 3, the case will need to be

```
expect(1 == 2).toBeTrue();
```

PR Close #34625
2020-04-08 12:10:34 -07:00
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
Andrew Kushnir d2623f13d9 style(zone.js): fix lint errors after clang update (#36487)
Recent ZoneJS-related commit (416c786774) update the `promise.ts` file, but it looks like original PR was not rebased after clang update. As a result, the `lint` CircleCI job started to fail in master after merging that PR (https://github.com/angular/angular/pull/36311). This commit updates the format of the `promise.ts` script according to the new clang rules.

PR Close #36487
2020-04-07 10:10:34 -07:00
JiaLiPassion 416c786774 fix(zone.js): should not try to patch fetch if it is not writable (#36311)
Close #36142

In Firefox extensions, the `window.fetch` is not configurable, that means

```
const desc = Object.getOwnPropertyDescriptor(window, 'fetch');
desc.writable === false;
```

So in this case, we should not try to patch `fetch`, otherwise, it will
throw error ('fetch is ReadOnly`)

PR Close #36311
2020-04-06 15:34:33 -07:00
JiaLiPassion 36e927a8c6 fix(zone.js): UNPATCHED_EVENTS and PASSIVE_EVENTS should be string[] not boolean (#36258)
__zone_symbol__UNPATCHED_EVENTS and __zone_symbol__PASSIVE_EVENTS should be string[] type not boolean.
For example:
```
const config = window as ZoneGlobalConfigurations;
config.__zone_symbol__UNPATCHED_EVENTS = ['scroll'];
config.__zone_symbol__PASSIVE_EVENTS = ['scroll'];
```

PR Close #36258
2020-04-01 13:20:00 -07:00
JiaLiPassion b44f7b5e16 fix(zone.js): fix 2 bluebird test cases for each/mapSeries (#36295)
`Bluebird.each` and `Bluebird.mapSeries` will accept a callback with `value` parameter,
the `value` should be the item in the array, not array itself.

For example:
```
const arr = [1, 2];
Bluebird.each(arr, function(value, idx) {
  console.log(`value: ${value}, idx: ${idx}`);
})
```

the output will be
```
value: 1, idx: 0
value: 2, idx: 1
```

This PR fix the test cases for `each` and `mapSeries` APIs.

PR Close #36295
2020-03-31 10:59:56 -07:00
Misko Hevery afc9839f43 build(zone.js): Update `zone.js` release process to use `google-wombot` (#36110)
Updated the docs to use the `google-wombot` release process.

PR Close #36110
2020-03-17 10:40:32 -07:00
JiaLiPassion e552591768 release: cut the zone.js-0.10.3 release (#34508)
PR Close #34508
2020-03-16 15:49:07 -07:00
JiaLiPassion 3fa895298d fix(zone.js): zone.js patches rxjs should check null for unsubscribe (#35990)
Close #31687, #31684

Zone.js patches rxjs internal `_subscribe` and `_unsubscribe` methods, but zone.js doesn't do null check, so in some operator such as `retryWhen`, the `_unsubscribe` will be set to null, and will cause
zone patched version throw error.

In this PR, if `_subscribe` and `_unsubscribe` is null, will not do the patch.

PR Close #35990
2020-03-16 09:01:17 -07:00
JiaLiPassion 54634628ac fix(zone.js): Make `EventTarget` methods optional in `zone.js` extension API (#35954)
`zone.js` added `removeAllListeners` and `eventListeners` methods in `EventTarget.prototype`, but those methods only exists when user import `zone.js` and also enables `EventTarget` monkey patching.

If user:
1. Does not import `zone.js` and uses `noop` zone when bootstrapping Angular app. OR
2. Disable monkey patching of `EventTarget` patch by defining `__Zone_disable_EventTarget = true`.

Then `removeAllListeners` and `eventListeners`  methods will not be present.

PR Close #35954
2020-03-16 09:00:44 -07:00
JiaLiPassion 8456c5ec60 feat(zone.js): add a zone config to allow user disable wrapping uncaught promise rejection (#35873)
Close #27840.

By default, `zone.js` wrap uncaught promise error and wrap it to a new Error object with some
additional information includes the value of the error and the stack trace.

Consider the following example:

```
Zone.current
  .fork({
    name: 'promise-error',
    onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any): boolean => {
      console.log('caught an error', error);
      delegate.handleError(target, error);
      return false;
    }
}).run(() => {
  const originalError = new Error('testError');
  Promise.reject(originalError);
});
```

The `promise-error` zone catches a wrapped `Error` object whose `rejection` property equals
to the original error, and the message will be `Uncaught (in promise): testError....`,
You can disable this wrapping behavior by defining a global configuraiton
`__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION = true;` before importing `zone.js`.

PR Close #35873
2020-03-16 09:00:10 -07:00
JiaLiPassion 0f8e710c7c feat(zone.js): Monkey patch MessagePort.prototype onproperties (#34610)
Monkey patch `MessagePort.prototype.onmessage` and `MessagePort.prototype.onmessageerror` to make
these properties's value(callback function) run in the zone when these value are set.

PR Close #34610
2020-03-16 08:59:38 -07:00
JiaLiPassion 99ea5d7044 fix(zone.js): fix `zone-patch-rxjs` bundle to refer to `rxjs` (rather than include) it. (#35983)
Close #35878.

Before zone.js 0.10, the rollup config would refer to `rxjs` when bundling `zone-patch-rxjs.js`
From zone.js 0.10, we started to use bazel to build `zone-patch-rxjs.js` and the configuration was wrongly defined to include a copy of `rxjs` in the `zone-patch-rxjs.js`.

PR Close #35983
2020-03-11 15:09:03 -07:00
Andrew Kushnir 71309d223d Revert "feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)" (#35973)
This reverts commit 1882451ec0.

Reason: breaks some g3 targets.

PR Close #35973
2020-03-09 17:31:28 -04:00
JiaLiPassion 1882451ec0 feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)
Close #34581

PR Close #34610
2020-03-09 12:20:46 -04:00
JiaLiPassion 55b3f97be0 fix(zone.js): `tickOptions`'s `processNewMacroTasksSynchronously` should default to true when flag omitted (#35814)
Calling `tick(0, null)` defaults `processNewMacroTasksSynchronously` flag to `true`, however calling  `tick(0, null, {})` defaults `processNewMacroTasksSynchronously` to `undefined`. This is undesirable behavior since unless the flag is set explicitly it should still default to `true`.

PR Close #35814
2020-03-06 17:33:57 -05:00
JiaLiPassion 86a45ff561 docs(zone.js): update coments of zone configuration API definition (#35849)
PR Close #35849
2020-03-06 16:55:32 -05:00
JiaLiPassion 84c2458ea7 refactor: cleanup zone.js test instruction (#34860)
PR Close #34860
2020-03-06 16:53:21 -05:00
Joey Perrott a1b90619ba test(zone.js): sets rollup_bundle to use the --silent flag in karma tests (#35881)
PR Close #35881
2020-03-06 12:37:55 -05:00
JiaLiPassion 8ef29b65ff fix: fix flaky test cases of passive events (#35679)
PR Close #35679
2020-03-05 15:56:53 -05:00
Joey Perrott ed44073a58 build(zone.js): sets rollup_bundle to use the --silent flag (#35835)
Using the --silent flag prevents the spammy logging messages in the
bazel execution logs.

```
INFO: From Bundling JavaScript packages/zone.js/dist/zone-rollup.umd.js [rollup]:

bazel-out/k8-fastbuild/bin/packages/zone.js/lib/browser/rollup-legacy-main.mjs → bazel-out/k8-fastbuild/bin/packages/zone.js/dist/zone-rollup.umd.js...
created bazel-out/k8-fastbuild/bin/packages/zone.js/dist/zone-rollup.umd.js in 736ms
```

PR Close #35835
2020-03-03 13:53:52 -08:00
JiaLiPassion 03d88c7965 feat: define all zone.js configurations to typescript interfaces (#35329)
PR Close #35329
2020-02-27 14:08:01 -08:00
JiaLiPassion 4acb676f2e feat: add interface definitions which zone extends EventTarget (#35304)
Close #35173

PR Close #35304
2020-02-26 12:52:08 -08:00
JiaLiPassion f9d483e76e feat: add a temp solution to support passive event listeners. (#34503)
Now Angular doesn't support add event listeners as passive very easily.
User needs to use `elem.addEventListener('scroll', listener, {passive: true});`
or implements their own EventManagerPlugin to do that.
Angular may finally support new template syntax to support passive event, for now,
this commit introduces a temp solution to allow user to define the passive event names
in zone.js configurations.

User can define a global varibale like this.

```
(window as any)['__zone_symbol__PASSIVE_EVENTS'] = ['scroll'];
```

to let all `scroll` event listeners passive.

PR Close #34503
2020-02-24 17:30:04 -08:00
Greg Magolan dde68ff954 build: add npm_integration_test && angular_integration_test (#33927)
* it's tricky to get out of the runfiles tree with `bazel test` as `BUILD_WORKSPACE_DIRECTORY` is not set but I employed a trick to read the `DO_NOT_BUILD_HERE` file that is one level up from `execroot` and that contains the workspace directory. This is experimental and if `bazel test //:test.debug` fails than `bazel run` is still guaranteed to work as  `BUILD_WORKSPACE_DIRECTORY` will be set in that context

* test //integration:bazel_test and //integration:bazel-schematics_test exclusively

* run "exclusive" and "manual" bazel-in-bazel integration tests in their own CI job as they take 8m+ to execute

```
//integration:bazel-schematics_test                                      PASSED in 317.2s
//integration:bazel_test                                                 PASSED in 167.8s
```

* Skip all integration tests that are now handled by angular_integration_test except the tests that are tracked for payload size; these are:
- cli-hello-world*
- hello_world__closure

* add & pin @babel deps as newer versions of babel break //packages/localize/src/tools/test:test

@babel/core dep had to be pinned to 7.6.4 or else //packages/localize/src/tools/test:test failed. Also //packages/localize uses @babel/generator, @babel/template, @babel/traverse & @babel/types so these deps were added to package.json as they were not being hoisted anymore from @babel/core transitive.

NB: integration/hello_world__systemjs_umd test must run with systemjs 0.20.0
NB: systemjs must be at 0.18.10 for legacy saucelabs job to pass
NB: With Bazel 2.0, the glob for the files to test `"integration/bazel/**"` is empty if integation/bazel is in .bazelignore. This glob worked under these conditions with 1.1.0. I did not bother testing with 1.2.x as not having integration/bazel in .bazelignore is correct.

PR Close #33927
2020-02-24 08:59:18 -08:00
Miško Hevery e084835fb1 Revert "feat: support passive event options by defining global variables in zone.js config file (#34503)"
This reverts commit d7d359e3ee.
2020-02-21 22:16:34 +00:00
JiaLiPassion d7d359e3ee feat: support passive event options by defining global variables in zone.js config file (#34503)
PR Close #34503
2020-02-21 09:06:26 -08:00
JiaLiPassion 39ef57971c build: refactor zone bazel settings (#34532)
PR Close #34532
2020-02-20 15:20:14 -08:00
JiaLiPassion 17b862cf82 feat: add an tickOptions parameter with property processNewMacroTasksSynchronously. (#33838)
This option will control whether to invoke the new macro tasks when ticking.

Close #33799

PR Close #33838
2020-02-20 15:14:59 -08:00
JiaLiPassion 332937ef24 feat: make mocha a zone module. (#34719)
PR Close #34719
2020-02-11 11:41:58 -08:00
JiaLiPassion e1160f19be feat: make jasmine patch as zone module (#34676)
PR Close #34676
2020-02-10 16:23:47 -08:00
JiaLiPassion daac33cdc8 feat: add basic jest support (#35080)
PR Close #35080
2020-02-07 11:43:21 -08:00
JiaLiPassion 3c30474417 docs: update zone-bluebird patch document for angular (#34536)
PR Close #34536
2020-02-03 14:05:22 -08:00
JiaLiPassion a3c7ab99b7 feat: performance improvement for eventListeners (#34613)
PR Close #34613
2020-02-03 08:40:49 -08:00
JiaLiPassion 58b29f1503 fix: should also allow subclass Promise without Symbol.species (#34533)
PR Close #34533
2020-01-31 13:17:59 -08:00
Greg Magolan a28c02bf89 build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736)
PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan 81f6da173b build: add a before-all-other bootstrap script that patches require (#34736)
This removes the churn in the existing bootstrap scripts.

PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan aee67f08d9 test: handle bootstrap templated_args in jasmine_node_test defaults.bzl (#34736)
PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan a4bbc35005 build: update to rules nodejs 1.0.1 (#34736)
This brings in a few minor fixes including a better way to patch require for bootstrap scripts

Also remove install_source_map_support attribute from nodejs_binary targets This attribute will be removed from nodejs_binary in the future

PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan dcff76e8b9 refactor: handle breaking changes in rules_nodejs 1.0.0 (#34736)
The major one that affects the angular repo is the removal of the bootstrap attribute in nodejs_binary, nodejs_test and jasmine_node_test in favor of using templated_args --node_options=--require=/path/to/script. The side-effect of this is that the bootstrap script does not get the require.resolve patches with explicitly loading the targets _loader.js file.

PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan 93c2df23bf build: upgrade to rules_nodejs 1.0.0 (first stable release) (#34736)
Brings in the fix for stamping which was preventing many targets from getting cached.

PR Close #34736
2020-01-15 14:58:07 -05:00
Andrius 1f79e624d1 build: typescript 3.7 support (#33717)
This PR updates TypeScript version to 3.7 while retaining compatibility with TS3.6.

PR Close #33717
2020-01-14 16:42:21 -08:00
Adam 55037d1107 build: bump year (#34651)
PR Close #34651
2020-01-13 07:21:43 -08:00
atscott e88d652f2a Revert "build: upgrade to rules_nodejs 1.0.0 (first stable release) (#34589)" (#34730)
This reverts commit cb6ffa1211.

PR Close #34730
2020-01-10 14:12:15 -08:00
atscott 538d0446b5 Revert "refactor: handle breaking changes in rules_nodejs 1.0.0 (#34589)" (#34730)
This reverts commit 9bb349e1c8.

PR Close #34730
2020-01-10 14:12:15 -08:00
atscott 6e5774b9a0 Revert "build: update to rules nodejs 1.0.1 (#34589)" (#34730)
This reverts commit 8042433cb0.

PR Close #34730
2020-01-10 14:12:15 -08:00