jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: Cannot read properties of undefined (reading 'each') of jest function in zone-testing

Open katedoctor opened this issue 1 year ago • 1 comments

Version

^29.7.0

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

katedoctor avatar Jan 10 '24 13:01 katedoctor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 09 '24 14:02 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Mar 10 '24 14:03 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Mar 10 '24 14:03 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

github-actions[bot] avatar Apr 10 '24 00:04 github-actions[bot]