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

[Bug]: Cannot read properties of undefined (reading 'each') of zone-testing #2211

Closed
katedoctor opened this issue Jan 10, 2024 · 6 comments
Closed

Comments

@katedoctor
Copy link

katedoctor commented Jan 10, 2024

Version

13.1.5

Steps to reproduce

  1. clone my repo https://github.com/katedoctor/testing_jest_angular
  2. npm i
  3. run 'NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest'

Expected behavior

I expected test pass

Actual behavior

src/app/test-editor/test-editor.component.spec.ts
● Test suite failed to run

TypeError: Cannot read properties of undefined (reading 'each')

  at node_modules/zone.js/fesm2015/zone-testing.js:758:77
      at Array.forEach (<anonymous>)
  at node_modules/zone.js/fesm2015/zone-testing.js:748:44
  at Zone.__load_patch (node_modules/zone.js/fesm2015/zone.js:79:33)
  at Object.<anonymous> (node_modules/zone.js/fesm2015/zone-testing.js:672:6)

zone-testing code:

['describe', 'xdescribe', 'fdescribe'].forEach(methodName => {
        let originalJestFn = context[methodName];
        if (context[Zone.__symbol__(methodName)]) {
            return;
        }
        context[Zone.__symbol__(methodName)] = originalJestFn;
        context[methodName] = function (...args) {
            args[1] = wrapDescribeInZone(args[1]);
            return originalJestFn.apply(this, args);
        };
        context[methodName].each = wrapDescribeFactoryInZone(originalJestFn.each);
    });

Additional context

No response

Environment

System:
    OS: macOS 13.2
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 19.2.0 - ~/.asdf/installs/nodejs/19.2.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.3 - ~/.asdf/plugins/nodejs/shims/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 11, 2024

There is an issue with the repo when running npm ci

npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://npm-proxy.fury.io/avidratings/~/up/ver_1hbGYu/avid-ui-lib-1.100.4.tgz
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

Would you pls take a look?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 11, 2024

Another thing you can do is checking the examples in https://github.com/thymikee/jest-preset-angular/tree/main/examples

@katedoctor
Copy link
Author

@ahnpnl yes, sorry. removed auth

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jul 19, 2024

We don’t maintain zone patch for Jest anymore. It is now maintained by Angular team.

cc @JiaLiPassion @alan-agius4

@alan-agius4
Copy link

@ahnpnl, feel free to close this issue in favor of angular/angular#57054

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jul 19, 2024

Thanks 🙏

@ahnpnl ahnpnl closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants