@d-es-ign/stryker-js-core 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +96 -0
- package/bin/stryker +2 -0
- package/bin/stryker.js +6 -0
- package/dist/src/checker/checker-child-process-proxy.d.ts +16 -0
- package/dist/src/checker/checker-child-process-proxy.d.ts.map +1 -0
- package/dist/src/checker/checker-child-process-proxy.js +22 -0
- package/dist/src/checker/checker-child-process-proxy.js.map +1 -0
- package/dist/src/checker/checker-facade.d.ts +9 -0
- package/dist/src/checker/checker-facade.d.ts.map +1 -0
- package/dist/src/checker/checker-facade.js +52 -0
- package/dist/src/checker/checker-facade.js.map +1 -0
- package/dist/src/checker/checker-factory.d.ts +10 -0
- package/dist/src/checker/checker-factory.d.ts.map +1 -0
- package/dist/src/checker/checker-factory.js +10 -0
- package/dist/src/checker/checker-factory.js.map +1 -0
- package/dist/src/checker/checker-resource.d.ts +8 -0
- package/dist/src/checker/checker-resource.d.ts.map +1 -0
- package/dist/src/checker/checker-resource.js +2 -0
- package/dist/src/checker/checker-resource.js.map +1 -0
- package/dist/src/checker/checker-retry-decorator.d.ts +12 -0
- package/dist/src/checker/checker-retry-decorator.d.ts.map +1 -0
- package/dist/src/checker/checker-retry-decorator.js +37 -0
- package/dist/src/checker/checker-retry-decorator.js.map +1 -0
- package/dist/src/checker/checker-worker.d.ts +14 -0
- package/dist/src/checker/checker-worker.d.ts.map +1 -0
- package/dist/src/checker/checker-worker.js +41 -0
- package/dist/src/checker/checker-worker.js.map +1 -0
- package/dist/src/checker/index.d.ts +4 -0
- package/dist/src/checker/index.d.ts.map +1 -0
- package/dist/src/checker/index.js +4 -0
- package/dist/src/checker/index.js.map +1 -0
- package/dist/src/child-proxy/child-process-crashed-error.d.ts +8 -0
- package/dist/src/child-proxy/child-process-crashed-error.d.ts.map +1 -0
- package/dist/src/child-proxy/child-process-crashed-error.js +16 -0
- package/dist/src/child-proxy/child-process-crashed-error.js.map +1 -0
- package/dist/src/child-proxy/child-process-proxy-worker.d.ts +32 -0
- package/dist/src/child-proxy/child-process-proxy-worker.d.ts.map +1 -0
- package/dist/src/child-proxy/child-process-proxy-worker.js +148 -0
- package/dist/src/child-proxy/child-process-proxy-worker.js.map +1 -0
- package/dist/src/child-proxy/child-process-proxy.d.ts +45 -0
- package/dist/src/child-proxy/child-process-proxy.d.ts.map +1 -0
- package/dist/src/child-proxy/child-process-proxy.js +232 -0
- package/dist/src/child-proxy/child-process-proxy.js.map +1 -0
- package/dist/src/child-proxy/id-generator.d.ts +5 -0
- package/dist/src/child-proxy/id-generator.d.ts.map +1 -0
- package/dist/src/child-proxy/id-generator.js +7 -0
- package/dist/src/child-proxy/id-generator.js.map +1 -0
- package/dist/src/child-proxy/message-protocol.d.ts +71 -0
- package/dist/src/child-proxy/message-protocol.d.ts.map +1 -0
- package/dist/src/child-proxy/message-protocol.js +34 -0
- package/dist/src/child-proxy/message-protocol.js.map +1 -0
- package/dist/src/child-proxy/out-of-memory-error.d.ts +5 -0
- package/dist/src/child-proxy/out-of-memory-error.d.ts.map +1 -0
- package/dist/src/child-proxy/out-of-memory-error.js +11 -0
- package/dist/src/child-proxy/out-of-memory-error.js.map +1 -0
- package/dist/src/concurrent/concurrency-token-provider.d.ts +20 -0
- package/dist/src/concurrent/concurrency-token-provider.d.ts.map +1 -0
- package/dist/src/concurrent/concurrency-token-provider.js +68 -0
- package/dist/src/concurrent/concurrency-token-provider.js.map +1 -0
- package/dist/src/concurrent/index.d.ts +4 -0
- package/dist/src/concurrent/index.d.ts.map +1 -0
- package/dist/src/concurrent/index.js +4 -0
- package/dist/src/concurrent/index.js.map +1 -0
- package/dist/src/concurrent/pool.d.ts +49 -0
- package/dist/src/concurrent/pool.d.ts.map +1 -0
- package/dist/src/concurrent/pool.js +137 -0
- package/dist/src/concurrent/pool.js.map +1 -0
- package/dist/src/concurrent/resource-decorator.d.ts +14 -0
- package/dist/src/concurrent/resource-decorator.d.ts.map +1 -0
- package/dist/src/concurrent/resource-decorator.js +24 -0
- package/dist/src/concurrent/resource-decorator.js.map +1 -0
- package/dist/src/config/config-file-formats.d.ts +6 -0
- package/dist/src/config/config-file-formats.d.ts.map +1 -0
- package/dist/src/config/config-file-formats.js +23 -0
- package/dist/src/config/config-file-formats.js.map +1 -0
- package/dist/src/config/config-reader.d.ts +23 -0
- package/dist/src/config/config-reader.d.ts.map +1 -0
- package/dist/src/config/config-reader.js +141 -0
- package/dist/src/config/config-reader.js.map +1 -0
- package/dist/src/config/file-matcher.d.ts +10 -0
- package/dist/src/config/file-matcher.d.ts.map +1 -0
- package/dist/src/config/file-matcher.js +31 -0
- package/dist/src/config/file-matcher.js.map +1 -0
- package/dist/src/config/index.d.ts +6 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +6 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/meta-schema-builder.d.ts +10 -0
- package/dist/src/config/meta-schema-builder.d.ts.map +1 -0
- package/dist/src/config/meta-schema-builder.js +30 -0
- package/dist/src/config/meta-schema-builder.js.map +1 -0
- package/dist/src/config/options-validator.d.ts +28 -0
- package/dist/src/config/options-validator.d.ts.map +1 -0
- package/dist/src/config/options-validator.js +213 -0
- package/dist/src/config/options-validator.js.map +1 -0
- package/dist/src/config/validation-errors.d.ts +7 -0
- package/dist/src/config/validation-errors.d.ts.map +1 -0
- package/dist/src/config/validation-errors.js +154 -0
- package/dist/src/config/validation-errors.js.map +1 -0
- package/dist/src/di/core-tokens.d.ts +40 -0
- package/dist/src/di/core-tokens.d.ts.map +1 -0
- package/dist/src/di/core-tokens.js +40 -0
- package/dist/src/di/core-tokens.js.map +1 -0
- package/dist/src/di/index.d.ts +4 -0
- package/dist/src/di/index.d.ts.map +1 -0
- package/dist/src/di/index.js +4 -0
- package/dist/src/di/index.js.map +1 -0
- package/dist/src/di/plugin-creator.d.ts +10 -0
- package/dist/src/di/plugin-creator.d.ts.map +1 -0
- package/dist/src/di/plugin-creator.js +51 -0
- package/dist/src/di/plugin-creator.js.map +1 -0
- package/dist/src/di/plugin-loader.d.ts +41 -0
- package/dist/src/di/plugin-loader.d.ts.map +1 -0
- package/dist/src/di/plugin-loader.js +153 -0
- package/dist/src/di/plugin-loader.js.map +1 -0
- package/dist/src/errors.d.ts +5 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +13 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/fs/file-system.d.ts +19 -0
- package/dist/src/fs/file-system.d.ts.map +1 -0
- package/dist/src/fs/file-system.js +52 -0
- package/dist/src/fs/file-system.js.map +1 -0
- package/dist/src/fs/index.d.ts +5 -0
- package/dist/src/fs/index.d.ts.map +1 -0
- package/dist/src/fs/index.js +5 -0
- package/dist/src/fs/index.js.map +1 -0
- package/dist/src/fs/project-file.d.ts +26 -0
- package/dist/src/fs/project-file.d.ts.map +1 -0
- package/dist/src/fs/project-file.js +87 -0
- package/dist/src/fs/project-file.js.map +1 -0
- package/dist/src/fs/project-reader.d.ts +51 -0
- package/dist/src/fs/project-reader.d.ts.map +1 -0
- package/dist/src/fs/project-reader.js +335 -0
- package/dist/src/fs/project-reader.js.map +1 -0
- package/dist/src/fs/project.d.ts +22 -0
- package/dist/src/fs/project.d.ts.map +1 -0
- package/dist/src/fs/project.js +65 -0
- package/dist/src/fs/project.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/initializer/custom-initializers/angular-initializer.d.ts +17 -0
- package/dist/src/initializer/custom-initializers/angular-initializer.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/angular-initializer.js +74 -0
- package/dist/src/initializer/custom-initializers/angular-initializer.js.map +1 -0
- package/dist/src/initializer/custom-initializers/custom-initializer.d.ts +13 -0
- package/dist/src/initializer/custom-initializers/custom-initializer.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/custom-initializer.js +2 -0
- package/dist/src/initializer/custom-initializers/custom-initializer.js.map +1 -0
- package/dist/src/initializer/custom-initializers/index.d.ts +14 -0
- package/dist/src/initializer/custom-initializers/index.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/index.js +16 -0
- package/dist/src/initializer/custom-initializers/index.js.map +1 -0
- package/dist/src/initializer/custom-initializers/react-initializer.d.ts +12 -0
- package/dist/src/initializer/custom-initializers/react-initializer.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/react-initializer.js +25 -0
- package/dist/src/initializer/custom-initializers/react-initializer.js.map +1 -0
- package/dist/src/initializer/custom-initializers/svelte-initializer.d.ts +6 -0
- package/dist/src/initializer/custom-initializers/svelte-initializer.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/svelte-initializer.js +33 -0
- package/dist/src/initializer/custom-initializers/svelte-initializer.js.map +1 -0
- package/dist/src/initializer/custom-initializers/vue-js-initializer.d.ts +11 -0
- package/dist/src/initializer/custom-initializers/vue-js-initializer.d.ts.map +1 -0
- package/dist/src/initializer/custom-initializers/vue-js-initializer.js +20 -0
- package/dist/src/initializer/custom-initializers/vue-js-initializer.js.map +1 -0
- package/dist/src/initializer/gitignore-writer.d.ts +7 -0
- package/dist/src/initializer/gitignore-writer.d.ts.map +1 -0
- package/dist/src/initializer/gitignore-writer.js +28 -0
- package/dist/src/initializer/gitignore-writer.js.map +1 -0
- package/dist/src/initializer/index.d.ts +6 -0
- package/dist/src/initializer/index.d.ts.map +1 -0
- package/dist/src/initializer/index.js +29 -0
- package/dist/src/initializer/index.js.map +1 -0
- package/dist/src/initializer/initializer-tokens.d.ts +9 -0
- package/dist/src/initializer/initializer-tokens.d.ts.map +1 -0
- package/dist/src/initializer/initializer-tokens.js +9 -0
- package/dist/src/initializer/initializer-tokens.js.map +1 -0
- package/dist/src/initializer/inquire.d.ts +12 -0
- package/dist/src/initializer/inquire.d.ts.map +1 -0
- package/dist/src/initializer/inquire.js +12 -0
- package/dist/src/initializer/inquire.js.map +1 -0
- package/dist/src/initializer/npm-client.d.ts +22 -0
- package/dist/src/initializer/npm-client.d.ts.map +1 -0
- package/dist/src/initializer/npm-client.js +65 -0
- package/dist/src/initializer/npm-client.js.map +1 -0
- package/dist/src/initializer/npm-registry.d.ts +13 -0
- package/dist/src/initializer/npm-registry.d.ts.map +1 -0
- package/dist/src/initializer/npm-registry.js +36 -0
- package/dist/src/initializer/npm-registry.js.map +1 -0
- package/dist/src/initializer/package-info.d.ts +10 -0
- package/dist/src/initializer/package-info.d.ts.map +1 -0
- package/dist/src/initializer/package-info.js +2 -0
- package/dist/src/initializer/package-info.js.map +1 -0
- package/dist/src/initializer/prompt-option.d.ts +6 -0
- package/dist/src/initializer/prompt-option.d.ts.map +1 -0
- package/dist/src/initializer/prompt-option.js +2 -0
- package/dist/src/initializer/prompt-option.js.map +1 -0
- package/dist/src/initializer/stryker-config-writer.d.ts +27 -0
- package/dist/src/initializer/stryker-config-writer.d.ts.map +1 -0
- package/dist/src/initializer/stryker-config-writer.js +106 -0
- package/dist/src/initializer/stryker-config-writer.js.map +1 -0
- package/dist/src/initializer/stryker-initializer.d.ts +45 -0
- package/dist/src/initializer/stryker-initializer.d.ts.map +1 -0
- package/dist/src/initializer/stryker-initializer.js +184 -0
- package/dist/src/initializer/stryker-initializer.js.map +1 -0
- package/dist/src/initializer/stryker-inquirer.d.ts +15 -0
- package/dist/src/initializer/stryker-inquirer.d.ts.map +1 -0
- package/dist/src/initializer/stryker-inquirer.js +72 -0
- package/dist/src/initializer/stryker-inquirer.js.map +1 -0
- package/dist/src/logging/index.d.ts +6 -0
- package/dist/src/logging/index.d.ts.map +1 -0
- package/dist/src/logging/index.js +5 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/logging/logger-impl.d.ts +19 -0
- package/dist/src/logging/logger-impl.d.ts.map +1 -0
- package/dist/src/logging/logger-impl.js +64 -0
- package/dist/src/logging/logger-impl.js.map +1 -0
- package/dist/src/logging/logging-backend.d.ts +22 -0
- package/dist/src/logging/logging-backend.d.ts.map +1 -0
- package/dist/src/logging/logging-backend.js +65 -0
- package/dist/src/logging/logging-backend.js.map +1 -0
- package/dist/src/logging/logging-client.d.ts +16 -0
- package/dist/src/logging/logging-client.d.ts.map +1 -0
- package/dist/src/logging/logging-client.js +44 -0
- package/dist/src/logging/logging-client.js.map +1 -0
- package/dist/src/logging/logging-event.d.ts +23 -0
- package/dist/src/logging/logging-event.d.ts.map +1 -0
- package/dist/src/logging/logging-event.js +63 -0
- package/dist/src/logging/logging-event.js.map +1 -0
- package/dist/src/logging/logging-server.d.ts +15 -0
- package/dist/src/logging/logging-server.d.ts.map +1 -0
- package/dist/src/logging/logging-server.js +43 -0
- package/dist/src/logging/logging-server.js.map +1 -0
- package/dist/src/logging/logging-sink.d.ts +7 -0
- package/dist/src/logging/logging-sink.d.ts.map +1 -0
- package/dist/src/logging/logging-sink.js +2 -0
- package/dist/src/logging/logging-sink.js.map +1 -0
- package/dist/src/logging/priority.d.ts +12 -0
- package/dist/src/logging/priority.d.ts.map +1 -0
- package/dist/src/logging/priority.js +13 -0
- package/dist/src/logging/priority.js.map +1 -0
- package/dist/src/logging/provide-logging.d.ts +30 -0
- package/dist/src/logging/provide-logging.d.ts.map +1 -0
- package/dist/src/logging/provide-logging.js +45 -0
- package/dist/src/logging/provide-logging.js.map +1 -0
- package/dist/src/mutants/diff-statistics-collector.d.ts +14 -0
- package/dist/src/mutants/diff-statistics-collector.d.ts.map +1 -0
- package/dist/src/mutants/diff-statistics-collector.js +40 -0
- package/dist/src/mutants/diff-statistics-collector.js.map +1 -0
- package/dist/src/mutants/incremental-differ.d.ts +39 -0
- package/dist/src/mutants/incremental-differ.d.ts.map +1 -0
- package/dist/src/mutants/incremental-differ.js +547 -0
- package/dist/src/mutants/incremental-differ.js.map +1 -0
- package/dist/src/mutants/index.d.ts +4 -0
- package/dist/src/mutants/index.d.ts.map +1 -0
- package/dist/src/mutants/index.js +4 -0
- package/dist/src/mutants/index.js.map +1 -0
- package/dist/src/mutants/mutant-test-planner.d.ts +36 -0
- package/dist/src/mutants/mutant-test-planner.d.ts.map +1 -0
- package/dist/src/mutants/mutant-test-planner.js +237 -0
- package/dist/src/mutants/mutant-test-planner.js.map +1 -0
- package/dist/src/mutants/test-coverage.d.ts +22 -0
- package/dist/src/mutants/test-coverage.d.ts.map +1 -0
- package/dist/src/mutants/test-coverage.js +87 -0
- package/dist/src/mutants/test-coverage.js.map +1 -0
- package/dist/src/process/1-prepare-executor.d.ts +22 -0
- package/dist/src/process/1-prepare-executor.d.ts.map +1 -0
- package/dist/src/process/1-prepare-executor.js +86 -0
- package/dist/src/process/1-prepare-executor.js.map +1 -0
- package/dist/src/process/2-mutant-instrumenter-executor.d.ts +39 -0
- package/dist/src/process/2-mutant-instrumenter-executor.d.ts.map +1 -0
- package/dist/src/process/2-mutant-instrumenter-executor.js +58 -0
- package/dist/src/process/2-mutant-instrumenter-executor.js.map +1 -0
- package/dist/src/process/3-dry-run-executor.d.ts +50 -0
- package/dist/src/process/3-dry-run-executor.d.ts.map +1 -0
- package/dist/src/process/3-dry-run-executor.js +164 -0
- package/dist/src/process/3-dry-run-executor.js.map +1 -0
- package/dist/src/process/4-mutation-test-executor.d.ts +56 -0
- package/dist/src/process/4-mutation-test-executor.d.ts.map +1 -0
- package/dist/src/process/4-mutation-test-executor.js +152 -0
- package/dist/src/process/4-mutation-test-executor.js.map +1 -0
- package/dist/src/process/index.d.ts +5 -0
- package/dist/src/process/index.d.ts.map +1 -0
- package/dist/src/process/index.js +5 -0
- package/dist/src/process/index.js.map +1 -0
- package/dist/src/reporters/broadcast-reporter.d.ts +25 -0
- package/dist/src/reporters/broadcast-reporter.d.ts.map +1 -0
- package/dist/src/reporters/broadcast-reporter.js +74 -0
- package/dist/src/reporters/broadcast-reporter.js.map +1 -0
- package/dist/src/reporters/ci/circle-provider.d.ts +11 -0
- package/dist/src/reporters/ci/circle-provider.d.ts.map +1 -0
- package/dist/src/reporters/ci/circle-provider.js +33 -0
- package/dist/src/reporters/ci/circle-provider.js.map +1 -0
- package/dist/src/reporters/ci/github-actions-provider.d.ts +9 -0
- package/dist/src/reporters/ci/github-actions-provider.d.ts.map +1 -0
- package/dist/src/reporters/ci/github-actions-provider.js +21 -0
- package/dist/src/reporters/ci/github-actions-provider.js.map +1 -0
- package/dist/src/reporters/ci/provider.d.ts +22 -0
- package/dist/src/reporters/ci/provider.d.ts.map +1 -0
- package/dist/src/reporters/ci/provider.js +24 -0
- package/dist/src/reporters/ci/provider.js.map +1 -0
- package/dist/src/reporters/ci/travis-provider.d.ts +9 -0
- package/dist/src/reporters/ci/travis-provider.d.ts.map +1 -0
- package/dist/src/reporters/ci/travis-provider.js +19 -0
- package/dist/src/reporters/ci/travis-provider.js.map +1 -0
- package/dist/src/reporters/clear-text-reporter.d.ts +23 -0
- package/dist/src/reporters/clear-text-reporter.d.ts.map +1 -0
- package/dist/src/reporters/clear-text-reporter.js +174 -0
- package/dist/src/reporters/clear-text-reporter.js.map +1 -0
- package/dist/src/reporters/clear-text-score-table.d.ts +22 -0
- package/dist/src/reporters/clear-text-score-table.d.ts.map +1 -0
- package/dist/src/reporters/clear-text-score-table.js +191 -0
- package/dist/src/reporters/clear-text-score-table.js.map +1 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.d.ts +19 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.d.ts.map +1 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.js +54 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.js.map +1 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter.d.ts +21 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter.d.ts.map +1 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter.js +62 -0
- package/dist/src/reporters/dashboard-reporter/dashboard-reporter.js.map +1 -0
- package/dist/src/reporters/dashboard-reporter/index.d.ts +7 -0
- package/dist/src/reporters/dashboard-reporter/index.d.ts.map +1 -0
- package/dist/src/reporters/dashboard-reporter/index.js +15 -0
- package/dist/src/reporters/dashboard-reporter/index.js.map +1 -0
- package/dist/src/reporters/dashboard-reporter/report.d.ts +6 -0
- package/dist/src/reporters/dashboard-reporter/report.d.ts.map +1 -0
- package/dist/src/reporters/dashboard-reporter/report.js +2 -0
- package/dist/src/reporters/dashboard-reporter/report.js.map +1 -0
- package/dist/src/reporters/dashboard-reporter/tokens.d.ts +6 -0
- package/dist/src/reporters/dashboard-reporter/tokens.d.ts.map +1 -0
- package/dist/src/reporters/dashboard-reporter/tokens.js +6 -0
- package/dist/src/reporters/dashboard-reporter/tokens.js.map +1 -0
- package/dist/src/reporters/dots-reporter.d.ts +7 -0
- package/dist/src/reporters/dots-reporter.d.ts.map +1 -0
- package/dist/src/reporters/dots-reporter.js +29 -0
- package/dist/src/reporters/dots-reporter.js.map +1 -0
- package/dist/src/reporters/event-recorder-reporter.d.ts +22 -0
- package/dist/src/reporters/event-recorder-reporter.d.ts.map +1 -0
- package/dist/src/reporters/event-recorder-reporter.js +53 -0
- package/dist/src/reporters/event-recorder-reporter.js.map +1 -0
- package/dist/src/reporters/html-reporter.d.ts +14 -0
- package/dist/src/reporters/html-reporter.d.ts.map +1 -0
- package/dist/src/reporters/html-reporter.js +65 -0
- package/dist/src/reporters/html-reporter.js.map +1 -0
- package/dist/src/reporters/index.d.ts +6 -0
- package/dist/src/reporters/index.d.ts.map +1 -0
- package/dist/src/reporters/index.js +24 -0
- package/dist/src/reporters/index.js.map +1 -0
- package/dist/src/reporters/json-reporter.d.ts +15 -0
- package/dist/src/reporters/json-reporter.d.ts.map +1 -0
- package/dist/src/reporters/json-reporter.js +29 -0
- package/dist/src/reporters/json-reporter.js.map +1 -0
- package/dist/src/reporters/mutation-test-report-helper.d.ts +40 -0
- package/dist/src/reporters/mutation-test-report-helper.d.ts.map +1 -0
- package/dist/src/reporters/mutation-test-report-helper.js +298 -0
- package/dist/src/reporters/mutation-test-report-helper.js.map +1 -0
- package/dist/src/reporters/mutation-timings-reporter.d.ts +14 -0
- package/dist/src/reporters/mutation-timings-reporter.d.ts.map +1 -0
- package/dist/src/reporters/mutation-timings-reporter.js +49 -0
- package/dist/src/reporters/mutation-timings-reporter.js.map +1 -0
- package/dist/src/reporters/progress-append-only-reporter.d.ts +10 -0
- package/dist/src/reporters/progress-append-only-reporter.d.ts.map +1 -0
- package/dist/src/reporters/progress-append-only-reporter.js +25 -0
- package/dist/src/reporters/progress-append-only-reporter.js.map +1 -0
- package/dist/src/reporters/progress-bar.d.ts +8 -0
- package/dist/src/reporters/progress-bar.d.ts.map +1 -0
- package/dist/src/reporters/progress-bar.js +6 -0
- package/dist/src/reporters/progress-bar.js.map +1 -0
- package/dist/src/reporters/progress-keeper.d.ts +27 -0
- package/dist/src/reporters/progress-keeper.d.ts.map +1 -0
- package/dist/src/reporters/progress-keeper.js +77 -0
- package/dist/src/reporters/progress-keeper.js.map +1 -0
- package/dist/src/reporters/progress-reporter.d.ts +11 -0
- package/dist/src/reporters/progress-reporter.d.ts.map +1 -0
- package/dist/src/reporters/progress-reporter.js +40 -0
- package/dist/src/reporters/progress-reporter.js.map +1 -0
- package/dist/src/reporters/reporter-util.d.ts +5 -0
- package/dist/src/reporters/reporter-util.d.ts.map +1 -0
- package/dist/src/reporters/reporter-util.js +19 -0
- package/dist/src/reporters/reporter-util.js.map +1 -0
- package/dist/src/reporters/strict-reporter.d.ts +3 -0
- package/dist/src/reporters/strict-reporter.d.ts.map +1 -0
- package/dist/src/reporters/strict-reporter.js +2 -0
- package/dist/src/reporters/strict-reporter.js.map +1 -0
- package/dist/src/sandbox/create-preprocessor.d.ts +7 -0
- package/dist/src/sandbox/create-preprocessor.d.ts.map +1 -0
- package/dist/src/sandbox/create-preprocessor.js +16 -0
- package/dist/src/sandbox/create-preprocessor.js.map +1 -0
- package/dist/src/sandbox/disable-type-checks-preprocessor.d.ts +18 -0
- package/dist/src/sandbox/disable-type-checks-preprocessor.d.ts.map +1 -0
- package/dist/src/sandbox/disable-type-checks-preprocessor.js +43 -0
- package/dist/src/sandbox/disable-type-checks-preprocessor.js.map +1 -0
- package/dist/src/sandbox/file-preprocessor.d.ts +10 -0
- package/dist/src/sandbox/file-preprocessor.d.ts.map +1 -0
- package/dist/src/sandbox/file-preprocessor.js +2 -0
- package/dist/src/sandbox/file-preprocessor.js.map +1 -0
- package/dist/src/sandbox/index.d.ts +4 -0
- package/dist/src/sandbox/index.d.ts.map +1 -0
- package/dist/src/sandbox/index.js +3 -0
- package/dist/src/sandbox/index.js.map +1 -0
- package/dist/src/sandbox/multi-preprocessor.d.ts +8 -0
- package/dist/src/sandbox/multi-preprocessor.d.ts.map +1 -0
- package/dist/src/sandbox/multi-preprocessor.js +12 -0
- package/dist/src/sandbox/multi-preprocessor.js.map +1 -0
- package/dist/src/sandbox/sandbox.d.ts +43 -0
- package/dist/src/sandbox/sandbox.d.ts.map +1 -0
- package/dist/src/sandbox/sandbox.js +134 -0
- package/dist/src/sandbox/sandbox.js.map +1 -0
- package/dist/src/sandbox/ts-config-preprocessor.d.ts +46 -0
- package/dist/src/sandbox/ts-config-preprocessor.d.ts.map +1 -0
- package/dist/src/sandbox/ts-config-preprocessor.js +112 -0
- package/dist/src/sandbox/ts-config-preprocessor.js.map +1 -0
- package/dist/src/stryker-cli.d.ts +15 -0
- package/dist/src/stryker-cli.d.ts.map +1 -0
- package/dist/src/stryker-cli.js +168 -0
- package/dist/src/stryker-cli.js.map +1 -0
- package/dist/src/stryker-package.d.ts +5 -0
- package/dist/src/stryker-package.d.ts.map +1 -0
- package/dist/src/stryker-package.js +7 -0
- package/dist/src/stryker-package.js.map +1 -0
- package/dist/src/stryker-server.d.ts +40 -0
- package/dist/src/stryker-server.d.ts.map +1 -0
- package/dist/src/stryker-server.js +234 -0
- package/dist/src/stryker-server.js.map +1 -0
- package/dist/src/stryker.d.ts +31 -0
- package/dist/src/stryker.d.ts.map +1 -0
- package/dist/src/stryker.js +86 -0
- package/dist/src/stryker.js.map +1 -0
- package/dist/src/test-runner/child-process-test-runner-proxy.d.ts +19 -0
- package/dist/src/test-runner/child-process-test-runner-proxy.d.ts.map +1 -0
- package/dist/src/test-runner/child-process-test-runner-proxy.js +45 -0
- package/dist/src/test-runner/child-process-test-runner-proxy.js.map +1 -0
- package/dist/src/test-runner/child-process-test-runner-worker.d.ts +14 -0
- package/dist/src/test-runner/child-process-test-runner-worker.d.ts.map +1 -0
- package/dist/src/test-runner/child-process-test-runner-worker.js +45 -0
- package/dist/src/test-runner/child-process-test-runner-worker.js.map +1 -0
- package/dist/src/test-runner/command-test-runner.d.ts +31 -0
- package/dist/src/test-runner/command-test-runner.d.ts.map +1 -0
- package/dist/src/test-runner/command-test-runner.js +144 -0
- package/dist/src/test-runner/command-test-runner.js.map +1 -0
- package/dist/src/test-runner/index.d.ts +11 -0
- package/dist/src/test-runner/index.d.ts.map +1 -0
- package/dist/src/test-runner/index.js +18 -0
- package/dist/src/test-runner/index.js.map +1 -0
- package/dist/src/test-runner/max-test-runner-reuse-decorator.d.ts +14 -0
- package/dist/src/test-runner/max-test-runner-reuse-decorator.d.ts.map +1 -0
- package/dist/src/test-runner/max-test-runner-reuse-decorator.js +25 -0
- package/dist/src/test-runner/max-test-runner-reuse-decorator.js.map +1 -0
- package/dist/src/test-runner/reload-environment-decorator.d.ts +11 -0
- package/dist/src/test-runner/reload-environment-decorator.d.ts.map +1 -0
- package/dist/src/test-runner/reload-environment-decorator.js +56 -0
- package/dist/src/test-runner/reload-environment-decorator.js.map +1 -0
- package/dist/src/test-runner/retry-rejected-decorator.d.ts +15 -0
- package/dist/src/test-runner/retry-rejected-decorator.d.ts.map +1 -0
- package/dist/src/test-runner/retry-rejected-decorator.js +59 -0
- package/dist/src/test-runner/retry-rejected-decorator.js.map +1 -0
- package/dist/src/test-runner/test-runner-decorator.d.ts +8 -0
- package/dist/src/test-runner/test-runner-decorator.d.ts.map +1 -0
- package/dist/src/test-runner/test-runner-decorator.js +13 -0
- package/dist/src/test-runner/test-runner-decorator.js.map +1 -0
- package/dist/src/test-runner/timeout-decorator.d.ts +15 -0
- package/dist/src/test-runner/timeout-decorator.d.ts.map +1 -0
- package/dist/src/test-runner/timeout-decorator.js +51 -0
- package/dist/src/test-runner/timeout-decorator.js.map +1 -0
- package/dist/src/unexpected-exit-handler.d.ts +13 -0
- package/dist/src/unexpected-exit-handler.d.ts.map +1 -0
- package/dist/src/unexpected-exit-handler.js +28 -0
- package/dist/src/unexpected-exit-handler.js.map +1 -0
- package/dist/src/utils/file-utils.d.ts +30 -0
- package/dist/src/utils/file-utils.d.ts.map +1 -0
- package/dist/src/utils/file-utils.js +101 -0
- package/dist/src/utils/file-utils.js.map +1 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +7 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/json-rpc-event-deserializer.d.ts +5 -0
- package/dist/src/utils/json-rpc-event-deserializer.d.ts.map +1 -0
- package/dist/src/utils/json-rpc-event-deserializer.js +42 -0
- package/dist/src/utils/json-rpc-event-deserializer.js.map +1 -0
- package/dist/src/utils/object-utils.d.ts +37 -0
- package/dist/src/utils/object-utils.d.ts.map +1 -0
- package/dist/src/utils/object-utils.js +91 -0
- package/dist/src/utils/object-utils.js.map +1 -0
- package/dist/src/utils/string-builder.d.ts +9 -0
- package/dist/src/utils/string-builder.d.ts.map +1 -0
- package/dist/src/utils/string-builder.js +26 -0
- package/dist/src/utils/string-builder.js.map +1 -0
- package/dist/src/utils/string-utils.d.ts +12 -0
- package/dist/src/utils/string-utils.d.ts.map +1 -0
- package/dist/src/utils/string-utils.js +54 -0
- package/dist/src/utils/string-utils.js.map +1 -0
- package/dist/src/utils/temporary-directory.d.ts +18 -0
- package/dist/src/utils/temporary-directory.d.ts.map +1 -0
- package/dist/src/utils/temporary-directory.js +63 -0
- package/dist/src/utils/temporary-directory.js.map +1 -0
- package/dist/src/utils/timer.d.ts +14 -0
- package/dist/src/utils/timer.d.ts.map +1 -0
- package/dist/src/utils/timer.js +53 -0
- package/dist/src/utils/timer.js.map +1 -0
- package/package.json +106 -0
- package/schema/stryker-schema.json +855 -0
- package/src/checker/checker-child-process-proxy.ts +67 -0
- package/src/checker/checker-facade.ts +90 -0
- package/src/checker/checker-factory.ts +46 -0
- package/src/checker/checker-resource.ts +12 -0
- package/src/checker/checker-retry-decorator.ts +57 -0
- package/src/checker/checker-worker.ts +62 -0
- package/src/checker/index.ts +3 -0
- package/src/child-proxy/child-process-crashed-error.ts +16 -0
- package/src/child-proxy/child-process-proxy-worker.ts +203 -0
- package/src/child-proxy/child-process-proxy.ts +353 -0
- package/src/child-proxy/id-generator.ts +6 -0
- package/src/child-proxy/message-protocol.ts +87 -0
- package/src/child-proxy/out-of-memory-error.ts +11 -0
- package/src/concurrent/concurrency-token-provider.ts +106 -0
- package/src/concurrent/index.ts +3 -0
- package/src/concurrent/pool.ts +209 -0
- package/src/concurrent/resource-decorator.ts +28 -0
- package/src/config/config-file-formats.ts +31 -0
- package/src/config/config-reader.ts +193 -0
- package/src/config/file-matcher.ts +36 -0
- package/src/config/index.ts +5 -0
- package/src/config/meta-schema-builder.ts +50 -0
- package/src/config/options-validator.ts +317 -0
- package/src/config/validation-errors.ts +192 -0
- package/src/di/core-tokens.ts +39 -0
- package/src/di/index.ts +4 -0
- package/src/di/plugin-creator.ts +102 -0
- package/src/di/plugin-loader.ts +245 -0
- package/src/errors.ts +12 -0
- package/src/fs/file-system.ts +63 -0
- package/src/fs/index.ts +4 -0
- package/src/fs/project-file.ts +100 -0
- package/src/fs/project-reader.ts +493 -0
- package/src/fs/project.ts +98 -0
- package/src/index.ts +7 -0
- package/src/initializer/custom-initializers/angular-initializer.ts +95 -0
- package/src/initializer/custom-initializers/custom-initializer.ts +14 -0
- package/src/initializer/custom-initializers/index.ts +31 -0
- package/src/initializer/custom-initializers/react-initializer.ts +35 -0
- package/src/initializer/custom-initializers/svelte-initializer.ts +40 -0
- package/src/initializer/custom-initializers/vue-js-initializer.ts +30 -0
- package/src/initializer/gitignore-writer.ts +33 -0
- package/src/initializer/index.ts +35 -0
- package/src/initializer/initializer-tokens.ts +8 -0
- package/src/initializer/inquire.ts +17 -0
- package/src/initializer/npm-client.ts +103 -0
- package/src/initializer/npm-registry.ts +48 -0
- package/src/initializer/package-info.ts +10 -0
- package/src/initializer/prompt-option.ts +6 -0
- package/src/initializer/stryker-config-writer.ts +158 -0
- package/src/initializer/stryker-initializer.ts +278 -0
- package/src/initializer/stryker-inquirer.ts +101 -0
- package/src/logging/index.ts +5 -0
- package/src/logging/logger-impl.ts +81 -0
- package/src/logging/logging-backend.ts +90 -0
- package/src/logging/logging-client.ts +56 -0
- package/src/logging/logging-event.ts +94 -0
- package/src/logging/logging-server.ts +56 -0
- package/src/logging/logging-sink.ts +7 -0
- package/src/logging/priority.ts +15 -0
- package/src/logging/provide-logging.ts +70 -0
- package/src/mutants/diff-statistics-collector.ts +47 -0
- package/src/mutants/incremental-differ.ts +771 -0
- package/src/mutants/index.ts +3 -0
- package/src/mutants/mutant-test-planner.ts +357 -0
- package/src/mutants/test-coverage.ts +125 -0
- package/src/process/1-prepare-executor.ts +133 -0
- package/src/process/2-mutant-instrumenter-executor.ts +122 -0
- package/src/process/3-dry-run-executor.ts +262 -0
- package/src/process/4-mutation-test-executor.ts +272 -0
- package/src/process/index.ts +4 -0
- package/src/reporters/broadcast-reporter.ts +129 -0
- package/src/reporters/ci/circle-provider.ts +50 -0
- package/src/reporters/ci/github-actions-provider.ts +22 -0
- package/src/reporters/ci/provider.ts +42 -0
- package/src/reporters/ci/travis-provider.ts +24 -0
- package/src/reporters/clear-text-reporter.ts +245 -0
- package/src/reporters/clear-text-score-table.ts +305 -0
- package/src/reporters/dashboard-reporter/dashboard-reporter-client.ts +89 -0
- package/src/reporters/dashboard-reporter/dashboard-reporter.ts +97 -0
- package/src/reporters/dashboard-reporter/index.ts +30 -0
- package/src/reporters/dashboard-reporter/report.ts +6 -0
- package/src/reporters/dashboard-reporter/tokens.ts +5 -0
- package/src/reporters/dots-reporter.ts +33 -0
- package/src/reporters/event-recorder-reporter.ts +88 -0
- package/src/reporters/html-reporter.ts +87 -0
- package/src/reporters/index.ts +48 -0
- package/src/reporters/json-reporter.ts +45 -0
- package/src/reporters/mutation-test-report-helper.ts +425 -0
- package/src/reporters/mutation-timings-reporter.ts +78 -0
- package/src/reporters/progress-append-only-reporter.ts +36 -0
- package/src/reporters/progress-bar.ts +6 -0
- package/src/reporters/progress-keeper.ts +113 -0
- package/src/reporters/progress-reporter.ts +62 -0
- package/src/reporters/reporter-util.ts +20 -0
- package/src/reporters/strict-reporter.ts +3 -0
- package/src/sandbox/create-preprocessor.ts +27 -0
- package/src/sandbox/disable-type-checks-preprocessor.ts +70 -0
- package/src/sandbox/file-preprocessor.ts +10 -0
- package/src/sandbox/index.ts +3 -0
- package/src/sandbox/multi-preprocessor.ts +13 -0
- package/src/sandbox/sandbox.ts +198 -0
- package/src/sandbox/ts-config-preprocessor.ts +168 -0
- package/src/stryker-cli.ts +363 -0
- package/src/stryker-package.ts +19 -0
- package/src/stryker-server.ts +334 -0
- package/src/stryker.ts +126 -0
- package/src/test-runner/child-process-test-runner-proxy.ts +94 -0
- package/src/test-runner/child-process-test-runner-worker.ts +66 -0
- package/src/test-runner/command-test-runner.ts +190 -0
- package/src/test-runner/index.ts +74 -0
- package/src/test-runner/max-test-runner-reuse-decorator.ts +41 -0
- package/src/test-runner/reload-environment-decorator.ts +72 -0
- package/src/test-runner/retry-rejected-decorator.ts +79 -0
- package/src/test-runner/test-runner-decorator.ts +22 -0
- package/src/test-runner/timeout-decorator.ts +71 -0
- package/src/unexpected-exit-handler.ts +36 -0
- package/src/utils/file-utils.ts +113 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/json-rpc-event-deserializer.ts +48 -0
- package/src/utils/object-utils.ts +106 -0
- package/src/utils/string-builder.ts +30 -0
- package/src/utils/string-utils.ts +61 -0
- package/src/utils/temporary-directory.ts +83 -0
- package/src/utils/timer.ts +58 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { isDeepStrictEqual } from 'util';
|
|
3
|
+
|
|
4
|
+
import { Minimatch } from 'minimatch';
|
|
5
|
+
import {
|
|
6
|
+
StrykerOptions,
|
|
7
|
+
FileDescriptions,
|
|
8
|
+
FileDescription,
|
|
9
|
+
Location,
|
|
10
|
+
Position,
|
|
11
|
+
} from '@stryker-mutator/api/core';
|
|
12
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
13
|
+
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
14
|
+
import {
|
|
15
|
+
ERROR_CODES,
|
|
16
|
+
I,
|
|
17
|
+
isErrnoException,
|
|
18
|
+
notEmpty,
|
|
19
|
+
} from '@stryker-mutator/util';
|
|
20
|
+
import type { MutationTestResult } from 'mutation-testing-report-schema/api';
|
|
21
|
+
|
|
22
|
+
import { OpenEndLocation } from 'mutation-testing-report-schema';
|
|
23
|
+
|
|
24
|
+
import { defaultOptions, FileMatcher } from '../config/index.js';
|
|
25
|
+
import { coreTokens } from '../di/index.js';
|
|
26
|
+
|
|
27
|
+
import { Project } from './project.js';
|
|
28
|
+
import { FileSystem } from './file-system.js';
|
|
29
|
+
|
|
30
|
+
const ALWAYS_IGNORE = Object.freeze([
|
|
31
|
+
'node_modules',
|
|
32
|
+
'.git',
|
|
33
|
+
'*.tsbuildinfo',
|
|
34
|
+
'/stryker.log',
|
|
35
|
+
'.next',
|
|
36
|
+
'.nuxt',
|
|
37
|
+
'.svelte-kit',
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
export const IGNORE_PATTERN_CHARACTER = '!';
|
|
41
|
+
/**
|
|
42
|
+
* @see https://stryker-mutator.io/docs/stryker-js/configuration/#mutate-string
|
|
43
|
+
* @example
|
|
44
|
+
* * "src/app.js:1-11" will mutate lines 1 through 11 inside app.js.
|
|
45
|
+
* * "src/app.js:5:4-6:4" will mutate from line 5, column 4 through line 6 column 4 inside app.js (columns 4 are included).
|
|
46
|
+
* * "src/app.js:5-6:4" will mutate from line 5, column 0 through line 6 column 4 inside app.js (column 4 is included).
|
|
47
|
+
*/
|
|
48
|
+
export const MUTATION_RANGE_REGEX =
|
|
49
|
+
/(.*?):((\d+)(?::(\d+))?-(\d+)(?::(\d+))?)$/;
|
|
50
|
+
|
|
51
|
+
export class ProjectReader {
|
|
52
|
+
private readonly mutatePatterns: readonly string[];
|
|
53
|
+
private readonly testFilePatterns: readonly string[];
|
|
54
|
+
private readonly ignoreRules: readonly string[];
|
|
55
|
+
private readonly incremental: boolean;
|
|
56
|
+
private readonly force: boolean;
|
|
57
|
+
private readonly incrementalFile: string;
|
|
58
|
+
|
|
59
|
+
public static inject = tokens(
|
|
60
|
+
coreTokens.fs,
|
|
61
|
+
commonTokens.logger,
|
|
62
|
+
commonTokens.options,
|
|
63
|
+
);
|
|
64
|
+
constructor(
|
|
65
|
+
private readonly fs: I<FileSystem>,
|
|
66
|
+
private readonly log: Logger,
|
|
67
|
+
{
|
|
68
|
+
mutate,
|
|
69
|
+
tempDirName,
|
|
70
|
+
ignorePatterns,
|
|
71
|
+
incremental,
|
|
72
|
+
incrementalFile,
|
|
73
|
+
force,
|
|
74
|
+
htmlReporter,
|
|
75
|
+
jsonReporter,
|
|
76
|
+
testFiles,
|
|
77
|
+
}: StrykerOptions,
|
|
78
|
+
) {
|
|
79
|
+
this.mutatePatterns = mutate;
|
|
80
|
+
this.testFilePatterns = testFiles ?? [];
|
|
81
|
+
this.ignoreRules = [
|
|
82
|
+
...ALWAYS_IGNORE,
|
|
83
|
+
tempDirName,
|
|
84
|
+
incrementalFile,
|
|
85
|
+
htmlReporter.fileName,
|
|
86
|
+
jsonReporter.fileName,
|
|
87
|
+
...ignorePatterns,
|
|
88
|
+
];
|
|
89
|
+
this.incremental = incremental;
|
|
90
|
+
this.incrementalFile = incrementalFile;
|
|
91
|
+
this.force = force;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public async read(
|
|
95
|
+
targetMutatePatterns: string[] | undefined,
|
|
96
|
+
): Promise<Project> {
|
|
97
|
+
const inputFileNames = await this.resolveInputFileNames();
|
|
98
|
+
const fileDescriptions = this.resolveFileDescriptions(
|
|
99
|
+
inputFileNames,
|
|
100
|
+
targetMutatePatterns,
|
|
101
|
+
);
|
|
102
|
+
const testFiles = this.resolveTestFiles(inputFileNames);
|
|
103
|
+
const project = new Project(
|
|
104
|
+
this.fs,
|
|
105
|
+
fileDescriptions,
|
|
106
|
+
await this.readIncrementalReport(),
|
|
107
|
+
testFiles,
|
|
108
|
+
);
|
|
109
|
+
project.logFiles(
|
|
110
|
+
this.log,
|
|
111
|
+
this.ignoreRules,
|
|
112
|
+
this.force,
|
|
113
|
+
this.mutatePatterns,
|
|
114
|
+
this.testFilePatterns,
|
|
115
|
+
);
|
|
116
|
+
return project;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Resolves test file patterns to actual file paths.
|
|
121
|
+
* @param inputFileNames The list of all input file names to filter
|
|
122
|
+
* @returns Array of resolved test file paths
|
|
123
|
+
*/
|
|
124
|
+
private resolveTestFiles(inputFileNames: string[]): string[] {
|
|
125
|
+
if (this.testFilePatterns.length === 0) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const resolvedTestFiles: string[] = [];
|
|
129
|
+
for (const pattern of this.testFilePatterns) {
|
|
130
|
+
const matcher = new FileMatcher(pattern, /* allowHiddenFiles */ false);
|
|
131
|
+
const matchedFiles = inputFileNames.filter((fileName) =>
|
|
132
|
+
matcher.matches(fileName),
|
|
133
|
+
);
|
|
134
|
+
if (matchedFiles.length === 0) {
|
|
135
|
+
this.log.warn(
|
|
136
|
+
`Glob pattern "${pattern}" did not match any test files.`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
resolvedTestFiles.push(...matchedFiles);
|
|
140
|
+
}
|
|
141
|
+
// Remove duplicates
|
|
142
|
+
return [...new Set(resolvedTestFiles)];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Takes the list of file names and creates file description object from it, containing logic about wether or not it needs to be mutated.
|
|
147
|
+
* If a mutate pattern starts with a `!`, it negates the pattern.
|
|
148
|
+
* @param inputFileNames the file names to filter
|
|
149
|
+
* @param targetMutatePatterns optional mutate patterns to limit the initial scope of files to mutate (with ranges)
|
|
150
|
+
*/
|
|
151
|
+
private resolveFileDescriptions(
|
|
152
|
+
inputFileNames: string[],
|
|
153
|
+
targetMutatePatterns: string[] | undefined,
|
|
154
|
+
): FileDescriptions {
|
|
155
|
+
// Only log about useless patterns when the user actually configured it
|
|
156
|
+
const logAboutUselessPatterns = !isDeepStrictEqual(
|
|
157
|
+
this.mutatePatterns,
|
|
158
|
+
defaultOptions.mutate,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Start out without files to mutate
|
|
162
|
+
const mutateInputFileMap = new Map<string, FileDescription>();
|
|
163
|
+
inputFileNames.forEach((fileName) =>
|
|
164
|
+
mutateInputFileMap.set(fileName, { mutate: false }),
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// Now lets see what we need to mutate
|
|
168
|
+
for (const pattern of this.mutatePatterns) {
|
|
169
|
+
if (pattern.startsWith(IGNORE_PATTERN_CHARACTER)) {
|
|
170
|
+
const files = this.filterMutatePattern(
|
|
171
|
+
mutateInputFileMap.keys(),
|
|
172
|
+
pattern.substring(1),
|
|
173
|
+
);
|
|
174
|
+
if (logAboutUselessPatterns && files.size === 0) {
|
|
175
|
+
this.log.warn(`Glob pattern "${pattern}" did not exclude any files.`);
|
|
176
|
+
}
|
|
177
|
+
for (const fileName of files.keys()) {
|
|
178
|
+
mutateInputFileMap.set(fileName, { mutate: false });
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
const files = this.filterMutatePattern(inputFileNames, pattern);
|
|
182
|
+
if (logAboutUselessPatterns && files.size === 0) {
|
|
183
|
+
this.log.warn(
|
|
184
|
+
`Glob pattern "${pattern}" did not result in any files.`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
for (const [fileName, file] of files) {
|
|
188
|
+
mutateInputFileMap.set(
|
|
189
|
+
fileName,
|
|
190
|
+
this.unionFileDescriptions(file, mutateInputFileMap.get(fileName)),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (targetMutatePatterns) {
|
|
197
|
+
// Now filter on the target patterns, but only when specified
|
|
198
|
+
// First, collect all files that should be mutated in 'seen'
|
|
199
|
+
const seen = new Map<string, FileDescription>();
|
|
200
|
+
for (const pattern of targetMutatePatterns) {
|
|
201
|
+
const files = this.filterMutatePattern(
|
|
202
|
+
mutateInputFileMap.keys(),
|
|
203
|
+
pattern,
|
|
204
|
+
);
|
|
205
|
+
for (const [fileName, description] of files) {
|
|
206
|
+
const intersected = this.intersectFileDescriptions(
|
|
207
|
+
mutateInputFileMap.get(fileName)!,
|
|
208
|
+
description,
|
|
209
|
+
);
|
|
210
|
+
seen.set(
|
|
211
|
+
fileName,
|
|
212
|
+
this.unionFileDescriptions(intersected, seen.get(fileName)),
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Now, reset the mutateInputFileMap to false for all files that we didn't see, but only mark files to be mutated when they appeared in the configured target patterns
|
|
217
|
+
// We do this so we return all the input files, with its status on whether or not to mutate it
|
|
218
|
+
for (const fileName of mutateInputFileMap.keys()) {
|
|
219
|
+
const descriptionInSeen = seen.get(fileName);
|
|
220
|
+
if (descriptionInSeen) {
|
|
221
|
+
mutateInputFileMap.set(fileName, descriptionInSeen);
|
|
222
|
+
} else {
|
|
223
|
+
mutateInputFileMap.set(fileName, { mutate: false });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Object.fromEntries(mutateInputFileMap);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private unionFileDescriptions(
|
|
231
|
+
first: FileDescription,
|
|
232
|
+
second?: FileDescription,
|
|
233
|
+
): FileDescription {
|
|
234
|
+
if (second) {
|
|
235
|
+
if (Array.isArray(first.mutate) && Array.isArray(second.mutate)) {
|
|
236
|
+
return { mutate: [...second.mutate, ...first.mutate] };
|
|
237
|
+
} else if (second.mutate === true) {
|
|
238
|
+
return { mutate: true };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return { mutate: first.mutate || second.mutate };
|
|
242
|
+
}
|
|
243
|
+
return first;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private intersectFileDescriptions(
|
|
247
|
+
first: FileDescription,
|
|
248
|
+
second: FileDescription,
|
|
249
|
+
): FileDescription {
|
|
250
|
+
if (Array.isArray(first.mutate) && Array.isArray(second.mutate)) {
|
|
251
|
+
// Both have mutation ranges, intersect them
|
|
252
|
+
const secondMutate = second.mutate;
|
|
253
|
+
const intersectedRanges = first.mutate
|
|
254
|
+
.flatMap((firstRange) =>
|
|
255
|
+
secondMutate.map((secondRange) => {
|
|
256
|
+
const startLine = Math.max(
|
|
257
|
+
firstRange.start.line,
|
|
258
|
+
secondRange.start.line,
|
|
259
|
+
);
|
|
260
|
+
const endLine = Math.min(firstRange.end.line, secondRange.end.line);
|
|
261
|
+
if (startLine > endLine) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const startColumn =
|
|
265
|
+
firstRange.start.line === startLine
|
|
266
|
+
? firstRange.start.column
|
|
267
|
+
: secondRange.start.column;
|
|
268
|
+
const endColumn =
|
|
269
|
+
firstRange.end.line === endLine
|
|
270
|
+
? firstRange.end.column
|
|
271
|
+
: secondRange.end.column;
|
|
272
|
+
return {
|
|
273
|
+
start: { line: startLine, column: startColumn },
|
|
274
|
+
end: { line: endLine, column: endColumn },
|
|
275
|
+
};
|
|
276
|
+
}),
|
|
277
|
+
)
|
|
278
|
+
.filter(notEmpty);
|
|
279
|
+
return { mutate: intersectedRanges };
|
|
280
|
+
} else if (first.mutate === true) {
|
|
281
|
+
return second;
|
|
282
|
+
} else if (second.mutate === true) {
|
|
283
|
+
return first;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Both have mutation ranges, but one of them is empty, so the intersection is empty
|
|
287
|
+
return { mutate: false };
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Filters a given list of file names given a mutate pattern.
|
|
292
|
+
* @param fileNames the file names to match to the pattern
|
|
293
|
+
* @param mutatePattern the pattern to match with
|
|
294
|
+
*/
|
|
295
|
+
private filterMutatePattern(
|
|
296
|
+
fileNames: Iterable<string>,
|
|
297
|
+
mutatePattern: string,
|
|
298
|
+
): Map<string, FileDescription> {
|
|
299
|
+
const mutationRangeMatch = MUTATION_RANGE_REGEX.exec(mutatePattern);
|
|
300
|
+
let mutate: FileDescription['mutate'] = true;
|
|
301
|
+
if (mutationRangeMatch) {
|
|
302
|
+
const [
|
|
303
|
+
_,
|
|
304
|
+
newPattern,
|
|
305
|
+
_mutationRange,
|
|
306
|
+
startLine,
|
|
307
|
+
startColumn = '0',
|
|
308
|
+
endLine,
|
|
309
|
+
endColumn = Number.MAX_SAFE_INTEGER.toString(),
|
|
310
|
+
] = mutationRangeMatch;
|
|
311
|
+
mutatePattern = newPattern;
|
|
312
|
+
mutate = [
|
|
313
|
+
{
|
|
314
|
+
start: {
|
|
315
|
+
line: parseInt(startLine) - 1,
|
|
316
|
+
column: parseInt(startColumn),
|
|
317
|
+
},
|
|
318
|
+
end: { line: parseInt(endLine) - 1, column: parseInt(endColumn) },
|
|
319
|
+
},
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
const matcher = new FileMatcher(
|
|
323
|
+
mutatePattern,
|
|
324
|
+
/* allowHiddenFiles */ false,
|
|
325
|
+
);
|
|
326
|
+
const inputFiles = new Map<string, FileDescription>();
|
|
327
|
+
for (const fileName of fileNames) {
|
|
328
|
+
if (matcher.matches(fileName)) {
|
|
329
|
+
inputFiles.set(fileName, { mutate });
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return inputFiles;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
private async resolveInputFileNames(): Promise<string[]> {
|
|
336
|
+
const ignoreRules = this.ignoreRules.map(
|
|
337
|
+
(pattern) =>
|
|
338
|
+
new Minimatch(pattern, { dot: true, flipNegate: true, nocase: true }),
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Rewrite of: https://github.com/npm/ignore-walk/blob/0e4f87adccb3e16f526d2e960ed04bdc77fd6cca/index.js#L213-L215
|
|
343
|
+
*/
|
|
344
|
+
const matchesDirectoryPartially = (entryPath: string, rule: Minimatch) => {
|
|
345
|
+
return rule.match(`/${entryPath}`, true) || rule.match(entryPath, true);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Inspired by https://github.com/npm/ignore-walk/blob/0e4f87adccb3e16f526d2e960ed04bdc77fd6cca/index.js#L124
|
|
349
|
+
const matchesDirectory = (
|
|
350
|
+
entryName: string,
|
|
351
|
+
entryPath: string,
|
|
352
|
+
rule: Minimatch,
|
|
353
|
+
) => {
|
|
354
|
+
return (
|
|
355
|
+
matchesFile(entryName, entryPath, rule) ||
|
|
356
|
+
rule.match(`/${entryPath}/`) ||
|
|
357
|
+
rule.match(`${entryPath}/`) ||
|
|
358
|
+
(rule.negate && matchesDirectoryPartially(entryPath, rule))
|
|
359
|
+
);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// Inspired by https://github.com/npm/ignore-walk/blob/0e4f87adccb3e16f526d2e960ed04bdc77fd6cca/index.js#L123
|
|
363
|
+
const matchesFile = (
|
|
364
|
+
entryName: string,
|
|
365
|
+
entryPath: string,
|
|
366
|
+
rule: Minimatch,
|
|
367
|
+
) => {
|
|
368
|
+
return (
|
|
369
|
+
rule.match(entryName) ||
|
|
370
|
+
rule.match(entryPath) ||
|
|
371
|
+
rule.match(`/${entryPath}`)
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const crawlDir = async (dir: string, rootDir = dir): Promise<string[]> => {
|
|
376
|
+
const dirEntries = await this.fs.readdir(dir, { withFileTypes: true });
|
|
377
|
+
const relativeName = path.relative(rootDir, dir);
|
|
378
|
+
const files = await Promise.all(
|
|
379
|
+
dirEntries
|
|
380
|
+
.filter((dirEntry) => {
|
|
381
|
+
let included = true;
|
|
382
|
+
const entryPath = `${relativeName.length ? `${relativeName}/` : ''}${dirEntry.name}`;
|
|
383
|
+
ignoreRules.forEach((rule) => {
|
|
384
|
+
if (rule.negate !== included) {
|
|
385
|
+
const match = dirEntry.isDirectory()
|
|
386
|
+
? matchesDirectory(dirEntry.name, entryPath, rule)
|
|
387
|
+
: matchesFile(dirEntry.name, entryPath, rule);
|
|
388
|
+
if (match) {
|
|
389
|
+
included = rule.negate;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
return included;
|
|
394
|
+
})
|
|
395
|
+
.map(async (dirent) => {
|
|
396
|
+
if (dirent.isDirectory()) {
|
|
397
|
+
return crawlDir(
|
|
398
|
+
path.resolve(rootDir, relativeName, dirent.name),
|
|
399
|
+
rootDir,
|
|
400
|
+
);
|
|
401
|
+
} else {
|
|
402
|
+
return path.resolve(rootDir, relativeName, dirent.name);
|
|
403
|
+
}
|
|
404
|
+
}),
|
|
405
|
+
);
|
|
406
|
+
return files.flat();
|
|
407
|
+
};
|
|
408
|
+
const files = await crawlDir(process.cwd());
|
|
409
|
+
return files;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
private async readIncrementalReport(): Promise<
|
|
413
|
+
MutationTestResult | undefined
|
|
414
|
+
> {
|
|
415
|
+
if (!this.incremental) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
try {
|
|
419
|
+
// TODO: Validate against the schema or stryker version?
|
|
420
|
+
const contents = await this.fs.readFile(this.incrementalFile, 'utf-8');
|
|
421
|
+
const result: MutationTestResult = JSON.parse(contents);
|
|
422
|
+
return {
|
|
423
|
+
...result,
|
|
424
|
+
files: Object.fromEntries(
|
|
425
|
+
Object.entries(result.files).map(([fileName, file]) => [
|
|
426
|
+
fileName,
|
|
427
|
+
{
|
|
428
|
+
...file,
|
|
429
|
+
mutants: file.mutants.map((mutant) => ({
|
|
430
|
+
...mutant,
|
|
431
|
+
location: reportLocationToStrykerLocation(mutant.location),
|
|
432
|
+
})),
|
|
433
|
+
},
|
|
434
|
+
]),
|
|
435
|
+
),
|
|
436
|
+
testFiles:
|
|
437
|
+
result.testFiles &&
|
|
438
|
+
Object.fromEntries(
|
|
439
|
+
Object.entries(result.testFiles).map(([fileName, file]) => [
|
|
440
|
+
fileName,
|
|
441
|
+
{
|
|
442
|
+
...file,
|
|
443
|
+
tests: file.tests.map((test) => ({
|
|
444
|
+
...test,
|
|
445
|
+
location:
|
|
446
|
+
test.location &&
|
|
447
|
+
reportOpenEndLocationToStrykerLocation(test.location),
|
|
448
|
+
})),
|
|
449
|
+
},
|
|
450
|
+
]),
|
|
451
|
+
),
|
|
452
|
+
};
|
|
453
|
+
} catch (err: unknown) {
|
|
454
|
+
if (
|
|
455
|
+
isErrnoException(err) &&
|
|
456
|
+
err.code === ERROR_CODES.NoSuchFileOrDirectory
|
|
457
|
+
) {
|
|
458
|
+
this.log.info(
|
|
459
|
+
'No incremental result file found at %s, a full mutation testing run will be performed.',
|
|
460
|
+
this.incrementalFile,
|
|
461
|
+
);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
// Whoops, didn't mean to catch this one!
|
|
465
|
+
throw err;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function reportOpenEndLocationToStrykerLocation({
|
|
471
|
+
start,
|
|
472
|
+
end,
|
|
473
|
+
}: OpenEndLocation): OpenEndLocation {
|
|
474
|
+
return {
|
|
475
|
+
start: reportPositionToStrykerPosition(start),
|
|
476
|
+
end: end && reportPositionToStrykerPosition(end),
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function reportLocationToStrykerLocation({ start, end }: Location): Location {
|
|
481
|
+
return {
|
|
482
|
+
start: reportPositionToStrykerPosition(start),
|
|
483
|
+
end: reportPositionToStrykerPosition(end),
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function reportPositionToStrykerPosition({ line, column }: Position): Position {
|
|
488
|
+
// stryker's positions are 0-based
|
|
489
|
+
return {
|
|
490
|
+
line: line - 1,
|
|
491
|
+
column: column - 1,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
2
|
+
import { FileDescriptions, StrykerOptions } from '@stryker-mutator/api/core';
|
|
3
|
+
import { I, normalizeWhitespaces, propertyPath } from '@stryker-mutator/util';
|
|
4
|
+
import { MutationTestResult } from 'mutation-testing-report-schema';
|
|
5
|
+
|
|
6
|
+
import { FileSystem } from './file-system.js';
|
|
7
|
+
import { ProjectFile } from './project-file.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the project that is under test by Stryker users.
|
|
11
|
+
* This represents the files in the current working directory.
|
|
12
|
+
* Each file can be read into memory when needed (via `readContent`)
|
|
13
|
+
*/
|
|
14
|
+
export class Project {
|
|
15
|
+
public readonly files = new Map<string, ProjectFile>();
|
|
16
|
+
public readonly filesToMutate = new Map<string, ProjectFile>();
|
|
17
|
+
public readonly testFiles: readonly string[];
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
fs: I<FileSystem>,
|
|
21
|
+
public readonly fileDescriptions: FileDescriptions,
|
|
22
|
+
public readonly incrementalReport?: MutationTestResult,
|
|
23
|
+
testFiles: readonly string[] = [],
|
|
24
|
+
) {
|
|
25
|
+
this.testFiles = testFiles;
|
|
26
|
+
Object.entries(fileDescriptions).forEach(([name, desc]) => {
|
|
27
|
+
const file = new ProjectFile(fs, name, desc.mutate);
|
|
28
|
+
this.files.set(name, file);
|
|
29
|
+
if (desc.mutate) {
|
|
30
|
+
this.filesToMutate.set(name, file);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public get isEmpty(): boolean {
|
|
36
|
+
return this.files.size === 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public logFiles(
|
|
40
|
+
log: Logger,
|
|
41
|
+
ignoreRules: readonly string[],
|
|
42
|
+
force: boolean,
|
|
43
|
+
mutatePatterns: readonly string[],
|
|
44
|
+
testFilePatterns: readonly string[] = [],
|
|
45
|
+
): void {
|
|
46
|
+
if (this.isEmpty) {
|
|
47
|
+
log.warn(
|
|
48
|
+
normalizeWhitespaces(`No files found in directory ${process.cwd()} using ignore rules: ${JSON.stringify(ignoreRules)}.
|
|
49
|
+
Make sure you run Stryker from the root directory of your project with the correct "${propertyPath<StrykerOptions>()('ignorePatterns')}".`),
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
if (this.filesToMutate.size) {
|
|
53
|
+
const incrementalInfo = this.incrementalReport
|
|
54
|
+
? ` using incremental report with ${Object.values(
|
|
55
|
+
this.incrementalReport.files,
|
|
56
|
+
).reduce(
|
|
57
|
+
(total, { mutants }) => total + mutants.length,
|
|
58
|
+
0,
|
|
59
|
+
)} mutant(s), and ${Object.values(this.incrementalReport.testFiles ?? {}).reduce((total, { tests }) => total + tests.length, 0)} test(s)${
|
|
60
|
+
force
|
|
61
|
+
? '. Force mode is activated, all mutants will be retested'
|
|
62
|
+
: ''
|
|
63
|
+
}`
|
|
64
|
+
: '';
|
|
65
|
+
log.info(
|
|
66
|
+
`Found ${this.filesToMutate.size} of ${this.files.size} file(s) to be mutated${incrementalInfo}.`,
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
const msg =
|
|
70
|
+
normalizeWhitespaces(`Warning: No files found for mutation with the given glob expressions. As a result, a dry-run will be performed without actually modifying anything.
|
|
71
|
+
If you intended to mutate files, please check and adjust the configuration.
|
|
72
|
+
Current glob pattern(s) used:
|
|
73
|
+
${new Intl.ListFormat('en').format(mutatePatterns.map((pattern) => `"${pattern}"`))}.
|
|
74
|
+
|
|
75
|
+
To enable file mutation, consider configuring the \`${propertyPath<StrykerOptions>()(
|
|
76
|
+
'mutate',
|
|
77
|
+
)}\` property in your configuration file or using the --mutate option via the command line.`);
|
|
78
|
+
log.warn(msg);
|
|
79
|
+
}
|
|
80
|
+
if (this.testFiles.length > 0) {
|
|
81
|
+
log.info(
|
|
82
|
+
`Found ${this.testFiles.length} test file(s) matching --testFiles patterns.`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
if (log.isDebugEnabled()) {
|
|
86
|
+
log.debug(
|
|
87
|
+
`All input files: ${JSON.stringify([...this.files.keys()], null, 2)}`,
|
|
88
|
+
);
|
|
89
|
+
log.debug(
|
|
90
|
+
`Files to mutate: ${JSON.stringify([...this.filesToMutate.keys()], null, 2)}`,
|
|
91
|
+
);
|
|
92
|
+
if (this.testFiles.length > 0) {
|
|
93
|
+
log.debug(`Test files: ${JSON.stringify(this.testFiles, null, 2)}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
|
|
4
|
+
import type { execaCommand } from 'execa';
|
|
5
|
+
import { StrykerOptions } from '@stryker-mutator/api/core';
|
|
6
|
+
import { Immutable, type resolveFromCwd } from '@stryker-mutator/util';
|
|
7
|
+
import { commonTokens } from '@stryker-mutator/api/plugin';
|
|
8
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
9
|
+
|
|
10
|
+
import semver from 'semver';
|
|
11
|
+
|
|
12
|
+
import { fileUtils } from '../../utils/file-utils.js';
|
|
13
|
+
import { coreTokens } from '../../di/index.js';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
CustomInitializer,
|
|
17
|
+
CustomInitializerConfiguration,
|
|
18
|
+
} from './custom-initializer.js';
|
|
19
|
+
|
|
20
|
+
const guideUrl = 'https://stryker-mutator.io/docs/stryker-js/guides/angular';
|
|
21
|
+
|
|
22
|
+
const karmaConfigFile = 'karma.conf.js';
|
|
23
|
+
|
|
24
|
+
export class AngularInitializer implements CustomInitializer {
|
|
25
|
+
public static inject = [
|
|
26
|
+
commonTokens.logger,
|
|
27
|
+
coreTokens.execa,
|
|
28
|
+
coreTokens.resolveFromCwd,
|
|
29
|
+
] as const;
|
|
30
|
+
constructor(
|
|
31
|
+
private readonly log: Logger,
|
|
32
|
+
private readonly execa: typeof execaCommand,
|
|
33
|
+
private readonly resolve: typeof resolveFromCwd,
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
public readonly name = 'angular-cli';
|
|
37
|
+
// Please keep config in sync with handbook
|
|
38
|
+
private readonly dependencies = ['@stryker-mutator/karma-runner'];
|
|
39
|
+
private readonly config: Immutable<Partial<StrykerOptions>> = {
|
|
40
|
+
mutate: [
|
|
41
|
+
'src/**/*.ts',
|
|
42
|
+
'!src/**/*.spec.ts',
|
|
43
|
+
'!src/test.ts',
|
|
44
|
+
'!src/environments/*.ts',
|
|
45
|
+
],
|
|
46
|
+
testRunner: 'karma',
|
|
47
|
+
karma: {
|
|
48
|
+
configFile: karmaConfigFile,
|
|
49
|
+
projectType: 'angular-cli',
|
|
50
|
+
config: {
|
|
51
|
+
browsers: ['ChromeHeadless'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
reporters: ['progress', 'clear-text', 'html'],
|
|
55
|
+
ignorers: ['angular'],
|
|
56
|
+
concurrency: Math.floor(os.cpus().length / 2),
|
|
57
|
+
|
|
58
|
+
concurrency_comment:
|
|
59
|
+
'Recommended to use about half of your available cores when running stryker with angular',
|
|
60
|
+
coverageAnalysis: 'perTest',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
public async createConfig(): Promise<CustomInitializerConfiguration> {
|
|
64
|
+
const [karmaConfigExists, ngVersionOutput] = await Promise.all([
|
|
65
|
+
fileUtils.exists(karmaConfigFile),
|
|
66
|
+
this.getCurrentAngularVersion(),
|
|
67
|
+
]);
|
|
68
|
+
if (
|
|
69
|
+
!karmaConfigExists &&
|
|
70
|
+
ngVersionOutput &&
|
|
71
|
+
semver.gte(ngVersionOutput, '15.1.0')
|
|
72
|
+
) {
|
|
73
|
+
const command = 'npx ng generate config karma';
|
|
74
|
+
this.log.info(
|
|
75
|
+
`No "karma.conf.js" file found, running command: "${command}"`,
|
|
76
|
+
);
|
|
77
|
+
const { stdout } = await this.execa(command);
|
|
78
|
+
this.log.info(`\n${stdout}`);
|
|
79
|
+
}
|
|
80
|
+
return { config: this.config, guideUrl, dependencies: this.dependencies };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private async getCurrentAngularVersion(): Promise<string | undefined> {
|
|
84
|
+
try {
|
|
85
|
+
const packageLocation = this.resolve('@angular/cli/package.json');
|
|
86
|
+
return JSON.parse(await fs.readFile(packageLocation, 'utf8')).version;
|
|
87
|
+
} catch (err) {
|
|
88
|
+
const error = err as Error;
|
|
89
|
+
this.log.warn(
|
|
90
|
+
`Could not discover your local angular-cli version. Continuing without generating karma configuration. ${error.stack}`,
|
|
91
|
+
);
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PartialStrykerOptions } from '@stryker-mutator/api/core';
|
|
2
|
+
import { Immutable } from '@stryker-mutator/util';
|
|
3
|
+
|
|
4
|
+
export interface CustomInitializer {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
createConfig(): Promise<CustomInitializerConfiguration>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CustomInitializerConfiguration {
|
|
10
|
+
config: Immutable<PartialStrykerOptions>;
|
|
11
|
+
guideUrl: string;
|
|
12
|
+
dependencies: string[];
|
|
13
|
+
additionalConfigFiles?: Record<string, string>;
|
|
14
|
+
}
|