-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Description
Describe the problem that you experienced
The documentation says:
To use
fakeAsync()functionality, you must importzone.js/testingin your test setup file. If you created your project with the Angular CLI,zone-testingis already imported insrc/test.ts.
But a project created with Angular CLI does not even have a src/test.ts file, let alone an import to any zone-testing.
Also, zone-testing is probably referring to the older import 'zone.js/dist/zone-testing', which is now properly exposed as zone.js/testing. zone-testing is mentioned once again on that page and might need updating to zone.js/testing, or an explanation of what it refers to.
Enter the URL of the topic with the problem
Describe what you were looking for in the documentation
I was reading about how fakeAsync works and what are the prerequisites for using it.
Describe the actions that led you to experience the problem
I am migrating a project from a custom set up with Angular 19 with tests in Karma to using Angular CLI with Angular 21 with tests in Vitest (ouch indeed) and this error pops up in some tests.
Expected to be running in 'ProxyZone', but it was not found.
Apparently it's related to fakeAsync not being set up properly. I ran ng new on the side to see what a clean project will generate now (so I can mimic it in my setup), and despite it using @angular/build:unit-test with the vitest runner, there's no src/test.ts file generated anywhere. So I assume the documentation here is wrong.
Describe what you want to experience that would fix the problem
It should probably either say that CLI handles this under the hood, or that we need to manually add "setupFiles" in angular.json to include it.
Add a screenshot if that helps illustrate the problem
No response
If this problem caused an exception or error, please paste it here
If the problem is browser-specific, please specify the device, OS, browser, and version
Provide any additional information here in as much as detail as you can