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

Worker crashes during jest testing #5082

Open
vinylhero opened this issue Oct 18, 2024 · 0 comments
Open

Worker crashes during jest testing #5082

vinylhero opened this issue Oct 18, 2024 · 0 comments
Labels
🐛 Bug Something isn't working

Comments

@vinylhero
Copy link

Summary

I'm trying to implement Stryker in my NX project on a small part of the code initially. I've managed to configure stryker to run my tests which seems to be happening. It seems like the process is running but i'm getting the below error, which I can't work out. As you can see the tests are running, but there's a random worker message that's blowing up.

16:09:42 (71394) ERROR Stryker Unexpected error occurred while running Stryker ChildProcessCrashedError: Child process [pid 71423] exited unexpectedly with exit code 1 (without signal). Last part of stdout and stderr was:
        PASS my-lib libs/my-lib/src/lib/factory/factory.spec.ts

        Test Suites: 1 passed, 1 total
        Tests:       2 passed, 2 total
        Snapshots:   0 total
        Time:        3.571 s
        Error: Unknown worker message type message
        This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
        Please open an issue with this stack trace at https://github.com/nodejs/node/issues

            at Function.fail (node:internal/assert:20:9)
            at Worker.[kOnMessage] (node:internal/worker:354:12)
            at MessagePort.<anonymous> (node:internal/worker:232:57)
            at _ZoneDelegate.invokeTask (my-project/node_modules/zone.js/bundles/zone.umd.js:449:37)
            at ZoneImpl.runTask (my-project/node_modules/zone.js/bundles/zone.umd.js:196:51)
            at ZoneTask.invokeTask [as invoke] (my-project/node_modules/zone.js/bundles/zone.umd.js:531:38)
            at invokeTask (my-project/node_modules/zone.js/bundles/zone.umd.js:1196:22)
            at globalCallback (my-project/node_modules/zone.js/bundles/zone.umd.js:1227:31)
            at MessagePort.globalZoneAwareCallback (my-project/node_modules/zone.js/bundles/zone.umd.js:1263:20)
            at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
            at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
          code: 'ERR_INTERNAL_ASSERTION'
        }

    at ChildProcess.handleUnexpectedExit (file://my-project/node_modules/@stryker-mutator/core/dist/src/child-proxy/child-process-proxy.js:180:31)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  innerError: undefined,
  pid: 71423,
  exitCode: 1,
  signal: null
}

Stryker config

{
  "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
  "packageManager": "npm",
  "reporters": ["html", "clear-text", "progress"],
  "coverageAnalysis": "perTest",
  "testRunner": "jest",
  "jest": {
    "projectType": "custom",
    "configFile": "libs/my-lib/jest.config.ts"
  },
  "checkers": ["typescript"],
  "tsconfigFile": "libs/my-lib/tsconfig.lib.prod.json",
  "typescriptChecker": {
    "prioritizePerformanceOverAccuracy": true
  },
  "commandRunner": {
    "command": "npx nx run web-auth-shell:test"
  },
  "symlinkNodeModules": false,
  "mutate": [
    "libs/my-lib/src/lib/**/*.ts",
    "!libs/my-lib/src/lib/**/*.spec.ts",
    "!libs/my-lib/src/lib/**/*.module.ts",
    "!libs/my-lib/src/lib/**/*.routes.ts",
    "!libs/my-lib/src/lib/api/**"
  ],
  "tempDirName": "libs/my-lib/.stryker-tmp",
  "fileLogLevel": "trace",
  "logLevel": "debug",
  "concurrency": 1
}

Test runner config

export default {
  displayName: 'web-auth-shell',
  preset: '../../jest.preset.js',
  setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
  globals: {},
  coverageDirectory: '../../coverage/libs/my-lib',
  transform: {
    '^.+.(ts|mjs|js|html)$': [
      'jest-preset-angular',
      {
        tsconfig: '<rootDir>/tsconfig.spec.json',
        stringifyContentPathRegex: '\\.(html|svg)$',
      },
    ],
  },
  transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
  snapshotSerializers: [
    'jest-preset-angular/build/serializers/no-ng-attributes',
    'jest-preset-angular/build/serializers/ng-snapshot',
    'jest-preset-angular/build/serializers/html-comment',
  ],
  testMatch: ['<rootDir>/src/**/?(*.)+(spec|test).ts?(x)'],
};

Stryker environment

"@stryker-mutator/core": "^8.6.0",
"@stryker-mutator/jest-runner": "^8.6.0",
"@stryker-mutator/typescript-checker": "^8.6.0",
    "jest": "29.7.0",
    "jest-preset-angular": "14.1.1",
    "@nx/angular": "~20.0.2",
    "@nx/devkit": "~20.0.2",
    "@nx/eslint": "~20.0.2",
    "@nx/eslint-plugin": "~20.0.2",
    "@nx/jest": "~20.0.2",
    "@nx/js": "~20.0.2",
    "@nx/plugin": "~20.0.2",
    "@nx/storybook": "~20.0.2",
    "@nx/workspace": "~20.0.2",

Test runner environment

npx stryker run libs/my-lib/stryker.config.json

Your Environment

software version(s)
node 20.18.0
npm 10.8.2
Operating System Mac Sonoma 14.6.1
@vinylhero vinylhero added the 🐛 Bug Something isn't working label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant