Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest runner throws zonejs missing error after updating to Angular v16 #332

Open
mal90 opened this issue Sep 15, 2023 · 1 comment
Open
Labels

Comments

@mal90
Copy link

mal90 commented Sep 15, 2023

We use vscode-jest-runner in our angular project. Since we updated angular to v16, getting this error

   ......
   Formatters › .booleanFormatter

    zone-testing.js is needed for the fakeAsync() test helper but could not be found.
            Please make sure that your environment includes zone.js/testing

      at resetFakeAsyncZone (node_modules/@angular/core/fesm2022/testing.mjs:249:11)
      at Object.<anonymous> (node_modules/@angular/core/fesm2022/testing.mjs:27123:13)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 21 skipped, 22 total
Snapshots:   0 total
Time:        3.578 s

image

As a fix, below 2 zonejs related import statements are added to the root jest setup config, and since this issue was resolved

import 'zone.js';
import 'zone.js/testing';

image

However i was wondering is there a way we can fix this issue without having to change the setup config, within the jest-runner extension itself?

@domsleee
Copy link
Collaborator

Hi, I think the scope of this extension is to make jest run by invoking the jest command.

It feels like having behaviour in the extension where the config automatically imports zone.js from the local package would be out of scope.

I think configs per frameworks like angular can be in separate repos like this one: https://github.com/thymikee/jest-preset-angular

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants