ITADN

Error when using vitest-runner with Angular contentChild signal

#5729Closedvinylhero 创建于 2026-01-15
🚀 Feature request
V
vinylherocommented
**Summary** I'm experiencing an issue when I run Stryker with the vitest-runner when the mutator tries to modify a `contentChild` signal. This doesn't seem to be an issue with the `@ContentChild` decorator. By telling stryker to avoid mutating the line below I can see that the run passes: ```ts // Stryker disable all readonly detail = contentChild(StepDetailDirective, { read: TemplateRef }); // Stryker restore all ``` **Stryker config** Below the "targetPath" is dynamic depending on the library under test (using NX). ```json { // Common settings packageManager: 'npm', reporters: ['progress', 'json'], testRunner: 'vitest', timeoutMS: 60000, coverageAnalysis: 'perTest', cleanTempDir: 'always', concurrency: 4, disableTypeChecks: false, ignoreStatic: true, ignorers: ['angular'], checkers: ['typescript'], // Incremental mode (speeds up subsequent runs) incremental: true, incrementalFile: `stryker-reports/${targetPath}-incremental.json`, // Dynamic settings based on the library path jsonReporter: { fileName: `stryker-reports/${targetPath}-mutations.json`, }, vitest: { configFile: `${targetPath}/vite.config.mts`, related: false }, tsconfigFile: `${targetPath}/tsconfig.stryker.json`, mutate: [ ${targetPath}/**/*.ts`, `!${targetPath}/**/*.spec.ts`, `!${targetPath}/**/*.stories.ts`, `!${targetPath}/**/*.module.ts`, `!${targetPath}/**/index.ts`, `!${targetPath}/**/test-setup.ts`, `!${targetPath}/e2e-tests/**/*.ts`, `!${targetPath}/docs/**/*.ts`, `!${targetPath}/.storybook/**/*.ts`, ] } ``` **Test runner config** Vitest Config (vite.config.mts) ```json { root: __dirname, cacheDir: '../../../../node_modules/.vite/libs/.../ui', plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], ssr: { noExternal: ['...'], }, test: { name: getNxProjectName(), watch: false, globals: true, environment: 'jsdom', include: ['src/**/*.spec.ts'], setupFiles: ['src/test-setup.ts'], reporters: ['default'], coverage: { reporter: ['lcov'], reportsDirectory: `${getNxWorkspaceRoot()}/coverage/${getNxProjectName()}`, provider: 'v8' as const, include: ['src/**/*.ts'], }, }, } ``` **Stryker environment** <!-- Please list your stryker plugins + versions here (output of `npm ls | grep stryker` or `npm ls | findstr "stryker"` on Windows) --> ``` "@stryker-mutator/core": "^9.4.0", "@stryker-mutator/typescript-checker": "^9.4.0", "@stryker-mutator/vitest-runner": "^9.4.0", "mutation-testing-elements": "^3.7.1", "mutation-testing-metrics": "^3.7.1", ``` ``` "vitest": "^3.0.0", ``` **Test runner environment** Test command varies depending on lib but essentially `vitest run` **Your Environment** | software | version(s) | ---------------- | ------- | node | v22.19.0 | npm | 10.9.3 | Operating System | Mac OS Tahoe 26.2 **Add stryker.log** ``` 10:40:35 (98498) ERROR Stryker Unexpected error occurred while running Stryker StrykerError: Error: FatalDiagnosticError: Code: 1010, Message: Argument needs to be an object literal. Error: FatalDiagnosticError: Code: 1010, Message: Argument needs to be an object literal. at tryParseSignalQueryFromInitializer (...repo/node_modules/@angular/compiler-cli/bundles/chunk-YDQJH54W.js:8940:11) at queryFunctionsTransforms (...repo/node_modules/@angular/compiler-cli/bundles/chunk-XC6P36QJ.js:438:27) at ...repo/node_modules/@angular/compiler-cli/bundles/chunk-XC6P36QJ.js:495:29 at Array.map (<anonymous>) at visitor (...repo/node_modules/@angular/compiler-cli/bundles/chunk-XC6P36QJ.js:486:38) at visitArrayWorker (...repo/node_modules/typescript/lib/typescript.js:95146:49) at visitNodes2 (...repo/node_modules/typescript/lib/typescript.js:95117:19) at visitLexicalEnvironment (...repo/node_modules/typescript/lib/typescript.js:95173:16) at visitEachChildOfSourceFile (...repo/node_modules/typescript/lib/typescript.js:96351:7) at Object.visitEachChild (...repo/node_modules/typescript/lib/typescript.js:95332:33) at ChildProcess.<anonymous> (...repo/node_modules/@stryker-mutator/core/dist/src/child-proxy/child-process-proxy.js:123:33) at ChildProcess.emit (node:events:519:28) at emit (node:internal/child_process:949:14) at process.processTicksAndRejections (node:internal/process/task_queues:91:21) { innerError: undefined } ```
关闭于 2026-01-30 1 条评论