0

我正在尝试为我的应用程序进行突变测试,但是当我运行我的 stryker 突变器时,它不会将任何测试纳入分析并执行空运行。

WARN InputFileResolver Glob pattern "src/**/*.ts" did not result in any files.
(10452) WARN InputFileResolver Glob pattern "!src/**/*.spec.ts" did not exclude any files.
(10452) WARN InputFileResolver Glob pattern "!src/test.ts" did not exclude any files.
(10452) WARN InputFileResolver Glob pattern "!src/environments/*.ts" did not exclude any files.
(10452) WARN InputFileResolver No files marked to be mutated, Stryker will perform a dry-run without actually mutating anything. You can configure the `mutate` property in your config file (or use `--mutate` via command line)

如您所见,我已经正确声明了我的 glob 模式,但这是完整的 stryker 配置:

/**
 * @type {import('@stryker-mutator/api/core').StrykerOptions}
 */
module.exports = {
  _comment:
    "This config was generated using 'stryker init'. Please see the guide for more information: https://stryker-mutator.io/docs/stryker-js/guides/angular",
  mutate: [
    "src/**/*.ts",
    "!=src/**/*.spec.ts",
    "!src/test.ts",
    "!src/environments/*.ts",
  ],
  testRunner: "jest",
  "jest": {
    "projectType": "custom",
    "configFile": "jest.config.js",
    "config": {
      "testEnvironment": "jest-environment-jsdom-sixteen"
    },
    "enableFindRelatedTests": true,
  },
  reporters: ["progress", "clear-text", "html"],
  concurrency: 4,
  concurrency_comment:
    "Recommended to use about half of your available cores when running stryker with angular",
  coverageAnalysis: "perTest",
};
4

1 回答 1

0

这是我的配置文件,它确实接受了我的测试。我正在使用最新版本。

/**
 * @type {import('@stryker-mutator/api/core').StrykerOptions}
 */
module.exports = {
    coverageAnalysis: 'off',
    packageManager: 'npm',
    reporters: ['html', 'clear-text', 'progress'],
    htmlReporter: {
        baseDir: 'docs/mutation'
    },
    testRunner: 'jest',
    mutate: [
        'src/**/*.ts',
        'src/**/*.service.ts',
        '!src/**/*.interface.ts',
        '!src/**/*.fake.ts',
        '!src/**/*.mock.ts',
        '!src/**/*.spec.ts',
        '!src/**/__mocks__/*',
        '!src/main.ts'
    ],
    timeoutMS: 30000   // Use extended timeoutMs for test run to remove Time Out Results
};
于 2021-06-18T13:57:29.747 回答