Commit graph

263 commits

Author SHA1 Message Date
Matthieu Riegler
2e4659648a refactor(zone.js): remove legacy browser support (#63511)
This commit removes the support for legacy browsers.

BREAKING CHANGE: IE/Non-Chromium Edge are not supported anymore.

PR Close #63511
2025-10-16 14:58:45 +00:00
Angular Robot
e23815bb7d build: update dependency typescript to v5.9.3 (#64207)
See associated pull request for more information.

Closes #64192 as a pr takeover

PR Close #64207
2025-10-02 20:48:42 +00:00
Joey Perrott
422a3b9ae6 test(zone.js): refactor tests to remove usage of shelljs (#64042)
Remove shelljs from zone.js tests

PR Close #64042
2025-09-26 13:14:08 -04:00
Joey Perrott
fe349827ef build: separate zone.js dependencies into their own directory (#63425)
Separate out zone.js dependencies

PR Close #63425
2025-09-05 12:52:55 -07:00
Joey Perrott
8738b81785 build: use common jasmine rule from dev-infra (#63568)
Use the new common jasmine rule from dev-infra which include sourcemap rewriting support and esm file loading

PR Close #63568
2025-09-03 16:34:08 +00:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Joey Perrott
f0ee681ad7 build: move macros/build set up for zone.js into zone.js directories (#63421)
Move the zone_bundle and configurations into zone.js's tool directory

PR Close #63421
2025-08-27 11:23:57 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Joey Perrott
3df1dccebe refactor: various build and import specificer fixes for strict deps (#63323)
Change direct deps in bazel targets and import specifiers within files to maintain strict deps requirements ahead of enabling strict deps tests in the repo

PR Close #63323
2025-08-22 14:45:00 -07:00
Joey Perrott
c35c0c7f2f build: update to bazel 7.6.0 (#63096)
Update to later version of bazel

PR Close #63096
2025-08-14 13:01:30 +02:00
Alan Agius
54fe7ca055 build: use link: instead of file: (#63111)
When using `file:` renovate updates fails due to ` ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND ` this is due to a different behaviour between `link:` amd `file:`. `link:` however will not fail when the directory does not exist.

PR Close #63111
2025-08-12 09:37:54 -07:00
Alan Agius
91f8963d86 build: fix ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND for typings tests (#63105)
During `pnpm install` in a monorepo setup, the `packages/zone.js/test/typings` project would fail with the error: `ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND: Could not install from "/.../node_modules/typescript" as it does not exist.`

PR Close #63105
2025-08-12 10:01:59 +02:00
Alan Agius
a786bb6f4b build: remove redundant yarn.lock files (#63105)
These are now managed by pnpm.

PR Close #63105
2025-08-12 10:01:59 +02:00
Matthieu Riegler
9aef481172 refactor(zone.js): remove unused jasmine globalerror monkey patching. (#63077)
This is for testing purposes for now. See discussion on the related issue.

fixes #63072

PR Close #63077
2025-08-11 16:41:09 -07:00
Andrew Scott
0a827f9284 refactor(zone.js): Add internal implementation for auto ticking fakeAsync (#62135)
Benefits of auto-ticking mock clocks have been described in other PRs,
such as https://github.com/jasmine/jasmine/pull/2042 and
https://github.com/sinonjs/fake-timers/pull/509. In short, `fakeAsync`
cannot work when some tasks are required to be truly async, such as XHRs
or observers like ResizeObserver. In addition, auto ticking mock clocks
can be applied to tests without the tests then needing to update
everything to manually flush timers.

PR Close #62135
2025-08-08 08:39:24 -07:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
008ed216d3 build: remove usages of runtime_rnjs_interop (#62908)
Remove all usages of the runtime_rnjs_interop feature

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
2f82d811e5 build: migrate zone.js tests to use web test runner instead of karma web tests (#62826)
Migrate zone.js bazel tests to use web test runner instead of karma

PR Close #62826
2025-07-28 14:18:45 +02:00
Joey Perrott
7c06aca4f0 build: move from using rollup to esbuild for bundling zone.js (#62775)
Use esbuild to bundle zone.js

PR Close #62775
2025-07-25 16:53:00 +02:00
Joey Perrott
caee6ff8e7 build: remove all usages of @bazel/runfiles (#62804)
Remove usages of @bazel/runfiles throughout the repository

PR Close #62804
2025-07-25 10:04:55 +02:00
Joey Perrott
f5d9d084b6 build: move nodejs_test to js_test (#62709)
Move nodejs_test to js_test and remove unnecessary files after move

PR Close #62709
2025-07-22 10:07:13 -04:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Joey Perrott
dd02bfe743 build: migrate zone.js to use ts_project instead of ts_library (#62673)
Use ts_project instead of ts_library for building zone.js

PR Close #62673
2025-07-17 13:59:37 -04:00
Alan Agius
8d049f533a build: update jest monorepo to v30 (#62234)
See associated pull request for more information.

Closes #61980 as a pr takeover

PR Close #62234
2025-06-24 10:49:30 +00:00
Joey Perrott
dfbdbbe882 refactor: use zone.js from npm instead of packages/zone.js throughout repo (#61977)
Use zone.js from npm isntead of from the repo going forward

PR Close #61977
2025-06-10 12:02:03 -07:00
Andrew Scott
3c216c1ec6 fix(zone.js): waitForAsync should pass args to the test function (#61755)
This ensures that test functions with arguments (e.g. `it.each` in jest)
are forwarded to the test function. This does not apply to jasmine,
which assumes the only arguments needed would be the `done` function.

fixes #61717

PR Close #61755
2025-06-09 11:22:22 -07:00
Andrew Scott
1ea39e050c refactor(zone.js): Add a withProxyZone helper that might be used for unpatched test frameworks (#61626)
As an alternative to monkey patching vitest, this change adds a method that could be used
for manually running functions inside a shared proxy zone. If used inocrrectly,
this would mean that
the `fakeAsync` closure may not capture all timers and microtasks if it
invokes things created in a zone that was already forked (e.g. creating
a component in a beforeEach:
2699dd6555/packages/zone.js/lib/jasmine/jasmine.ts (L363-L371))

PR Close #61626
2025-05-22 13:39:30 -07:00
Andrew Scott
ad8931cb49 fix(zone.js): classes that extend Error should retain cause property (#61599)
ZoneAwareError previously did not copy the cause property over to the
`this` object when an error extends the native error class.

PR Close #61599
2025-05-21 20:43:09 -07:00
arturovt
2235699b65 refactor(zone.js): drop isIE checks (#61091)
This should not be considered as a breaking change, because Angular doesn't support IE.

PR Close #61091
2025-05-02 07:53:35 -07:00
Andrew Kushnir
4f46b02f29 test(zone.js): reduce flakiness of a timer-related test (#59653)
This commit updates a flaky test to increase the amount of work (more `for` loop iterations) to minimize the chance of getting the same timestamp after that work.

PR Close #59653
2025-01-21 13:20:24 -08:00
Alan Agius
01fcbafa2b build: update cross-repo angular dependencies (#58446)
See associated pull request for more information.

Closes #57880 as a pr takeover

PR Close #58446
2024-10-31 19:05:01 +01:00
arturovt
69763491c3 fix(zone.js): remove abort listener once fetch is settled (#57882)
This commit updates the `fetch` patch for zone.js. Currently, we're attaching an
`abort` event listener on the signal (when it's provided) and never removing it.
We should be good citizens and remove event listeners whenever objects need to be
properly collected. In Firefox, when saving a heap snapshot and running it through
`fxsnapshot`, querying `AbortSignal` will print a so-called "CaptureMap" with a list
of "lambdas," indicating that the signal is not garbage collected because of the event
listener lambda function.

PR Close #57882
2024-10-07 08:27:53 -07:00
Joey Perrott
9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00
Kristiyan Kostadinov
e608e6cfbb fix(zone.js): more robust check for promise-like objects (#57388)
Fixes that Zone.js wasn't checking properly if an object is promise-like.

Fixes #57385.

PR Close #57388
2024-08-23 12:58:29 -07:00
Matthieu Riegler
e1240c6f5d fix(zone.js): Add support for addition jest functions. (#57280)
This commit add support for `test.failing` and `it.failing`.

Fixes #57277

PR Close #57280
2024-08-07 18:13:51 +00:00
Andrew Scott
70e8b40750 fix(zone.js): Update the default behavior of fakeAsync to flush after the test (#57240)
From the internal issue on the matter:

> When using the standard Jasmine version of it promises returned by the body function are automatically awaited. The Catalyst version of it is fake-async, so awaiting the promise does not make sense; however it would be nice if Catalyst automatically flushed the promise to replicate the experience of using standard it. This would allow users to do the following:

```
it('should fail later', async () => {
  await new Promise(r => setTimeout(r));
  fail('failure');
});
```
> In Catalyst today the above test will pass. If this proposal to automatically flush the resulting promise were implemented it would fail.

Flushing after the tests complete has been the default behavior inside
Google since 2020. Very few tests remain that use the old behavior of
only flushing microtasks. The example above would actually fail with
`fakeAsync` due to the pending timer, but the argument still remains the
same. We might as well just flush if we're going to fail the test
anyways by throwing if there's no flush at the end.

BREAKING CHANGE: `fakeAsync` will now flush pending timers at the end of
the given function by default. To opt-out of this, you can use `{flush:
false}` in options parameter of `fakeAsync`

PR Close #57240
2024-08-05 20:24:54 +00:00
Alan Agius
982f1b1251 fix(zone.js): support Timeout.refresh in Node.js (#56852)
The `Timeout` object in Node.js has a `refresh` method, used to restart `setTimeout`/`setInterval` timers. Before this commit, `Timeout.refresh` was not handled, leading to memory leaks when using `fetch` in Node.js. This issue arose because `undici` (the Node.js fetch implementation) uses a refreshed `setTimeout` for cleanup operations.

For reference, see: 1dff4fd9b1/lib/util/timers.js (L45)

Fixes: #56586

PR Close #56852
2024-07-16 12:46:51 -07:00
arturovt
4a3800a6a0 fix(zone.js): store remove abort listener on the scheduled task (#56160)
Prior to this commit, a memory leak occurred when the `abort` listener was
not removed from the `AbortSignal`. We introduced a fix to remove the event
listener, but it was erroneously stored on the `taskData`, which is a shared
global object. Consequently, when something attempted to remove an event listener,
it immediately removed the last stored abort listener. As a result, events would
never be canceled.

We have now rectified this by storing the remove abort listener function directly on
the task itself. This adjustment ensures that the abort listener is tied only to the
specific task. When the `abort` function is called, it cancels the task. Therefore, it
is safe to associate the cleanup function directly with the task.

Closes: #56148

PR Close #56160
2024-06-04 17:29:05 +00:00
arturovt
85c171920a fix(zone.js): do not mutate event listener options (may be readonly) (#55796)
Prior to this commit, event listener options were mutated directly, for example,
`options.signal = undefined` or `options.once = false`.

This issue arises in apps using third-party libraries where the responsibility lies
with the library provider. Some libraries, like WalletConnect, pass an abort controller
as `addEventListener` options. Because the abort controller has the `signal` property,
this is a valid case. Thus, mutating options would throw an error since `signal`
is a readonly property.

Even though zone.js is being deprecated as Angular moves towards zoneless change detection,
this fix is necessary for apps that still use zone.js and cannot migrate to zoneless change
detection because they rely on third-party libraries and are not responsible for the code
used in them.

Closes #54142

PR Close #55796
2024-05-22 16:20:34 -07:00
Alan Agius
20a530acb6 fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
https://github.com/angular/angular/pull/53443 caused the a local `rxjs` file to be imported from an entry-point which caused this to be excluded from being bundled due to the name matching `rxjs`.

Closes #55825

PR Close #55826
2024-05-16 09:21:17 -07:00
Joey Perrott
f307e95459 refactor: migrate zone.js to prettier formatting (#55427)
Migrate formatting to prettier for zone.js from clang-format

PR Close #55427
2024-04-29 09:52:05 -07:00
Alan Agius
b0f1552ffe build: use installed deps from main repo (#55433)
This commit updates the zone.js types tests to use the deps installed in the main repo

PR Close #55433
2024-04-22 11:40:07 -07:00
Alan Agius
15f19820b0 build: update Domino to 8f228f8862540c6ccd14f76b5a1d9bb5458618af (#55424)
This contains the fix for https://github.com/angular/angular/issues/55416

PR Close #55424
2024-04-19 13:24:25 -07:00
Andrea Canciani
f3b624553a refactor: fix a number of typos throughout the codebase (#55018)
Fix some typos detected using spellchecking tools, both in
documentation and in code (comments, identifiers).

PR Close #55018
2024-03-27 10:54:31 -07:00
JiaLiPassion
e44b077cbd fix(zone.js): should not clear onhandler when remove capture listener (#54602)
Close #54581

Should not clear `onHandler` when remove capture event listeners.

PR Close #54602
2024-03-27 10:40:05 -07:00
Andrea Canciani
9dabef08ec test(zone.js): fix zone.js test listener removal (#55017)
The test was checking the wrong set of listeners because of a typo.

PR Close #55017
2024-03-25 11:16:06 -07:00
Doug Parker
635227b881 refactor(zone.js): package Zone *.d.ts files (#53443)
This was a bit complicated, but the typings test (`packages/zone.js/test/typings/...`) was failing due to an unresolved import on `./zone-impl`.

The main cause is that `//packages/zone.js:zone_js_d_ts` was generating the output `zone.d.ts` file by _concatenating_ `zone.d.ts` with `zone.api.extensions.d.ts` and `zone.configurations.api.d.ts`. Now that `zone.d.ts` imports `zone-impl.d.ts`, concatenation is no longer a viable means of bundling this content.

To fix this, I created a new `packages/zone.js/zone.ts` entry point and imported the underlying `zone.ts` file as well as the two extensions. I added `extract_types` to pull the `*.d.ts` files out of the target (because all the JS is bundled separately) and used those files in the final NPM package. This is sufficient to pass the typings test and should be equivalent to what exists today.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker
79308d1668 refactor(zone.js): fix Node fs tests (#53443)
Not sure why this becomes a problem now. These errors appear to be preexisting. Most likely the file wasn't loaded previously and now it is.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker
cb0379c8df refactor(zone.js): fix Node error disable/lazy policy tests (#53443)
The lazy policy tests call the same error policy entry point, so this fixes both at the same time.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker
e8e1178e42 refactor(zone.js): fix Bluebird test by updating the entry point and calling patches appropriately (#53443)
This executes the patches in the top-level scope of the Bluebird test.

PR Close #53443
2024-03-15 18:11:34 -07:00