@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,122 @@
|
|
|
1
|
+
import type { execaCommand } from 'execa';
|
|
2
|
+
import {
|
|
3
|
+
Injector,
|
|
4
|
+
tokens,
|
|
5
|
+
commonTokens,
|
|
6
|
+
PluginContext,
|
|
7
|
+
PluginKind,
|
|
8
|
+
} from '@stryker-mutator/api/plugin';
|
|
9
|
+
import {
|
|
10
|
+
createInstrumenter,
|
|
11
|
+
InstrumentResult,
|
|
12
|
+
} from '@stryker-mutator/instrumenter';
|
|
13
|
+
import { StrykerOptions } from '@stryker-mutator/api/core';
|
|
14
|
+
import { Reporter } from '@stryker-mutator/api/report';
|
|
15
|
+
import { I } from '@stryker-mutator/util';
|
|
16
|
+
|
|
17
|
+
import { coreTokens, PluginCreator } from '../di/index.js';
|
|
18
|
+
import { Sandbox } from '../sandbox/sandbox.js';
|
|
19
|
+
import {
|
|
20
|
+
ConcurrencyTokenProvider,
|
|
21
|
+
createCheckerPool,
|
|
22
|
+
} from '../concurrent/index.js';
|
|
23
|
+
import { createCheckerFactory } from '../checker/index.js';
|
|
24
|
+
import { createPreprocessor } from '../sandbox/index.js';
|
|
25
|
+
import { Timer } from '../utils/timer.js';
|
|
26
|
+
import { TemporaryDirectory } from '../utils/temporary-directory.js';
|
|
27
|
+
import { UnexpectedExitHandler } from '../unexpected-exit-handler.js';
|
|
28
|
+
import { FileSystem, Project } from '../fs/index.js';
|
|
29
|
+
import { IdGenerator } from '../child-proxy/id-generator.js';
|
|
30
|
+
|
|
31
|
+
import { DryRunContext } from './3-dry-run-executor.js';
|
|
32
|
+
|
|
33
|
+
export interface MutantInstrumenterContext extends PluginContext {
|
|
34
|
+
[commonTokens.options]: StrykerOptions;
|
|
35
|
+
[coreTokens.project]: Project;
|
|
36
|
+
[coreTokens.reporter]: Required<Reporter>;
|
|
37
|
+
[coreTokens.timer]: I<Timer>;
|
|
38
|
+
[coreTokens.temporaryDirectory]: I<TemporaryDirectory>;
|
|
39
|
+
[coreTokens.execa]: typeof execaCommand;
|
|
40
|
+
[coreTokens.process]: NodeJS.Process;
|
|
41
|
+
[coreTokens.unexpectedExitRegistry]: I<UnexpectedExitHandler>;
|
|
42
|
+
[coreTokens.pluginModulePaths]: readonly string[];
|
|
43
|
+
[coreTokens.fs]: I<FileSystem>;
|
|
44
|
+
[coreTokens.pluginCreator]: PluginCreator;
|
|
45
|
+
[coreTokens.loggingServerAddress]: { port: number };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class MutantInstrumenterExecutor {
|
|
49
|
+
public static readonly inject = tokens(
|
|
50
|
+
commonTokens.injector,
|
|
51
|
+
coreTokens.project,
|
|
52
|
+
commonTokens.options,
|
|
53
|
+
coreTokens.pluginCreator,
|
|
54
|
+
);
|
|
55
|
+
constructor(
|
|
56
|
+
private readonly injector: Injector<MutantInstrumenterContext>,
|
|
57
|
+
private readonly project: Project,
|
|
58
|
+
private readonly options: StrykerOptions,
|
|
59
|
+
private readonly pluginCreator: PluginCreator,
|
|
60
|
+
) {}
|
|
61
|
+
|
|
62
|
+
public async execute(): Promise<Injector<DryRunContext>> {
|
|
63
|
+
// Create the checker and instrumenter
|
|
64
|
+
const instrumenter = this.injector.injectFunction(createInstrumenter);
|
|
65
|
+
|
|
66
|
+
// Instrument files in-memory
|
|
67
|
+
const ignorers = this.options.ignorers.map((name) =>
|
|
68
|
+
this.pluginCreator.create(PluginKind.Ignore, name),
|
|
69
|
+
);
|
|
70
|
+
const instrumentResult = await instrumenter.instrument(
|
|
71
|
+
await this.readFilesToMutate(),
|
|
72
|
+
{ ignorers, ...this.options.mutator },
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// Preprocess the project
|
|
76
|
+
const preprocess = this.injector.injectFunction(createPreprocessor);
|
|
77
|
+
this.writeInstrumentedFiles(instrumentResult);
|
|
78
|
+
await preprocess.preprocess(this.project);
|
|
79
|
+
|
|
80
|
+
// Initialize the checker pool
|
|
81
|
+
const concurrencyTokenProviderProvider = this.injector.provideClass(
|
|
82
|
+
coreTokens.concurrencyTokenProvider,
|
|
83
|
+
ConcurrencyTokenProvider,
|
|
84
|
+
);
|
|
85
|
+
const concurrencyTokenProvider = concurrencyTokenProviderProvider.resolve(
|
|
86
|
+
coreTokens.concurrencyTokenProvider,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const checkerPoolProvider = concurrencyTokenProviderProvider
|
|
90
|
+
.provideValue(
|
|
91
|
+
coreTokens.checkerConcurrencyTokens,
|
|
92
|
+
concurrencyTokenProvider.checkerToken$,
|
|
93
|
+
)
|
|
94
|
+
.provideClass(coreTokens.workerIdGenerator, IdGenerator)
|
|
95
|
+
.provideFactory(coreTokens.checkerFactory, createCheckerFactory)
|
|
96
|
+
.provideFactory(coreTokens.checkerPool, createCheckerPool);
|
|
97
|
+
const checkerPool = checkerPoolProvider.resolve(coreTokens.checkerPool);
|
|
98
|
+
await checkerPool.init();
|
|
99
|
+
|
|
100
|
+
// Feed the sandbox
|
|
101
|
+
const dryRunProvider = checkerPoolProvider
|
|
102
|
+
.provideClass(coreTokens.sandbox, Sandbox)
|
|
103
|
+
.provideValue(coreTokens.mutants, instrumentResult.mutants);
|
|
104
|
+
const sandbox = dryRunProvider.resolve(coreTokens.sandbox);
|
|
105
|
+
await sandbox.init();
|
|
106
|
+
return dryRunProvider;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private readFilesToMutate() {
|
|
110
|
+
return Promise.all(
|
|
111
|
+
[...this.project.filesToMutate.values()].map((file) =>
|
|
112
|
+
file.toInstrumenterFile(),
|
|
113
|
+
),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private writeInstrumentedFiles(instrumentResult: InstrumentResult): void {
|
|
118
|
+
for (const { name, content } of Object.values(instrumentResult.files)) {
|
|
119
|
+
this.project.files.get(name)!.setContent(content);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { EOL } from 'os';
|
|
2
|
+
|
|
3
|
+
import { I, requireResolve } from '@stryker-mutator/util';
|
|
4
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
5
|
+
import { commonTokens, tokens, Injector } from '@stryker-mutator/api/plugin';
|
|
6
|
+
import { StrykerOptions, Mutant } from '@stryker-mutator/api/core';
|
|
7
|
+
import { DryRunCompletedEvent, RunTiming } from '@stryker-mutator/api/report';
|
|
8
|
+
import {
|
|
9
|
+
DryRunResult,
|
|
10
|
+
TestRunner,
|
|
11
|
+
DryRunStatus,
|
|
12
|
+
CompleteDryRunResult,
|
|
13
|
+
TestStatus,
|
|
14
|
+
TestResult,
|
|
15
|
+
FailedTestResult,
|
|
16
|
+
ErrorDryRunResult,
|
|
17
|
+
} from '@stryker-mutator/api/test-runner';
|
|
18
|
+
import { lastValueFrom, of } from 'rxjs';
|
|
19
|
+
|
|
20
|
+
import { coreTokens } from '../di/index.js';
|
|
21
|
+
import { Sandbox } from '../sandbox/sandbox.js';
|
|
22
|
+
import { Timer } from '../utils/timer.js';
|
|
23
|
+
import { createTestRunnerFactory } from '../test-runner/index.js';
|
|
24
|
+
import { MutationTestReportHelper } from '../reporters/mutation-test-report-helper.js';
|
|
25
|
+
import { ConfigError } from '../errors.js';
|
|
26
|
+
import {
|
|
27
|
+
ConcurrencyTokenProvider,
|
|
28
|
+
Pool,
|
|
29
|
+
createTestRunnerPool,
|
|
30
|
+
} from '../concurrent/index.js';
|
|
31
|
+
import { FileMatcher } from '../config/index.js';
|
|
32
|
+
import {
|
|
33
|
+
IncrementalDiffer,
|
|
34
|
+
MutantTestPlanner,
|
|
35
|
+
TestCoverage,
|
|
36
|
+
} from '../mutants/index.js';
|
|
37
|
+
import { CheckerFacade } from '../checker/index.js';
|
|
38
|
+
import { StrictReporter } from '../reporters/index.js';
|
|
39
|
+
import { objectUtils } from '../utils/object-utils.js';
|
|
40
|
+
|
|
41
|
+
import { IdGenerator } from '../child-proxy/id-generator.js';
|
|
42
|
+
|
|
43
|
+
import { MutationTestContext } from './4-mutation-test-executor.js';
|
|
44
|
+
import { MutantInstrumenterContext } from './2-mutant-instrumenter-executor.js';
|
|
45
|
+
|
|
46
|
+
const INITIAL_TEST_RUN_MARKER = 'Initial test run';
|
|
47
|
+
|
|
48
|
+
export interface DryRunContext extends MutantInstrumenterContext {
|
|
49
|
+
[coreTokens.sandbox]: I<Sandbox>;
|
|
50
|
+
[coreTokens.mutants]: readonly Mutant[];
|
|
51
|
+
[coreTokens.checkerPool]: I<Pool<I<CheckerFacade>>>;
|
|
52
|
+
[coreTokens.concurrencyTokenProvider]: I<ConcurrencyTokenProvider>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isFailedTest(testResult: TestResult): testResult is FailedTestResult {
|
|
56
|
+
return testResult.status === TestStatus.Failed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class DryRunExecutor {
|
|
60
|
+
public static readonly inject = tokens(
|
|
61
|
+
commonTokens.injector,
|
|
62
|
+
commonTokens.logger,
|
|
63
|
+
commonTokens.options,
|
|
64
|
+
coreTokens.timer,
|
|
65
|
+
coreTokens.concurrencyTokenProvider,
|
|
66
|
+
coreTokens.sandbox,
|
|
67
|
+
coreTokens.reporter,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
constructor(
|
|
71
|
+
private readonly injector: Injector<DryRunContext>,
|
|
72
|
+
private readonly log: Logger,
|
|
73
|
+
private readonly options: StrykerOptions,
|
|
74
|
+
private readonly timer: I<Timer>,
|
|
75
|
+
private readonly concurrencyTokenProvider: I<ConcurrencyTokenProvider>,
|
|
76
|
+
private readonly sandbox: I<Sandbox>,
|
|
77
|
+
private readonly reporter: StrictReporter,
|
|
78
|
+
) {}
|
|
79
|
+
|
|
80
|
+
public async execute(): Promise<Injector<MutationTestContext>> {
|
|
81
|
+
const testRunnerInjector = this.injector
|
|
82
|
+
.provideClass(coreTokens.workerIdGenerator, IdGenerator)
|
|
83
|
+
.provideFactory(coreTokens.testRunnerFactory, createTestRunnerFactory)
|
|
84
|
+
.provideValue(
|
|
85
|
+
coreTokens.testRunnerConcurrencyTokens,
|
|
86
|
+
this.concurrencyTokenProvider.testRunnerToken$,
|
|
87
|
+
)
|
|
88
|
+
.provideFactory(coreTokens.testRunnerPool, createTestRunnerPool);
|
|
89
|
+
const testRunnerPool = testRunnerInjector.resolve(
|
|
90
|
+
coreTokens.testRunnerPool,
|
|
91
|
+
);
|
|
92
|
+
const { result, timing } = await lastValueFrom(
|
|
93
|
+
testRunnerPool.schedule(of(0), (testRunner) =>
|
|
94
|
+
this.executeDryRun(testRunner),
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
this.logInitialTestRunSucceeded(result.tests, timing);
|
|
99
|
+
if (!result.tests.length && !this.options.allowEmpty) {
|
|
100
|
+
throw new ConfigError(
|
|
101
|
+
'No tests were executed. Stryker will exit prematurely. Please check your configuration.',
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return testRunnerInjector
|
|
106
|
+
.provideValue(coreTokens.timeOverheadMS, timing.overhead)
|
|
107
|
+
.provideValue(coreTokens.dryRunResult, result)
|
|
108
|
+
.provideValue(coreTokens.requireFromCwd, requireResolve)
|
|
109
|
+
.provideFactory(coreTokens.testCoverage, TestCoverage.from)
|
|
110
|
+
.provideClass(coreTokens.incrementalDiffer, IncrementalDiffer)
|
|
111
|
+
.provideClass(coreTokens.mutantTestPlanner, MutantTestPlanner)
|
|
112
|
+
.provideClass(
|
|
113
|
+
coreTokens.mutationTestReportHelper,
|
|
114
|
+
MutationTestReportHelper,
|
|
115
|
+
)
|
|
116
|
+
.provideClass(coreTokens.workerIdGenerator, IdGenerator);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private validateResultCompleted(
|
|
120
|
+
runResult: DryRunResult,
|
|
121
|
+
): asserts runResult is CompleteDryRunResult {
|
|
122
|
+
switch (runResult.status) {
|
|
123
|
+
case DryRunStatus.Complete: {
|
|
124
|
+
const failedTests = runResult.tests.filter(isFailedTest);
|
|
125
|
+
if (failedTests.length) {
|
|
126
|
+
this.logFailedTestsInInitialRun(failedTests);
|
|
127
|
+
throw new ConfigError(
|
|
128
|
+
'There were failed tests in the initial test run.',
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
case DryRunStatus.Error:
|
|
134
|
+
this.logErrorsInInitialRun(runResult);
|
|
135
|
+
break;
|
|
136
|
+
case DryRunStatus.Timeout:
|
|
137
|
+
this.logTimeoutInitialRun();
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
throw new Error('Something went wrong in the initial test run');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private async executeDryRun(
|
|
144
|
+
testRunner: TestRunner,
|
|
145
|
+
): Promise<DryRunCompletedEvent> {
|
|
146
|
+
if (this.options.dryRunOnly) {
|
|
147
|
+
this.log.info(
|
|
148
|
+
'Note: running the dry-run only. No mutations will be tested.',
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const dryRunTimeout = this.options.dryRunTimeoutMinutes * 1000 * 60;
|
|
153
|
+
const project = this.injector.resolve(coreTokens.project);
|
|
154
|
+
const dryRunFiles = objectUtils.map(project.filesToMutate, (_, name) =>
|
|
155
|
+
this.sandbox.sandboxFileFor(name),
|
|
156
|
+
);
|
|
157
|
+
const testFiles =
|
|
158
|
+
project.testFiles.length > 0
|
|
159
|
+
? project.testFiles.map((file) => this.sandbox.sandboxFileFor(file))
|
|
160
|
+
: undefined;
|
|
161
|
+
this.timer.mark(INITIAL_TEST_RUN_MARKER);
|
|
162
|
+
this.log.info(
|
|
163
|
+
`Starting initial test run (${this.options.testRunner} test runner with "${this.options.coverageAnalysis}" coverage analysis). This may take a while.`,
|
|
164
|
+
);
|
|
165
|
+
this.log.debug(`Using timeout of ${dryRunTimeout} ms.`);
|
|
166
|
+
const result = await testRunner.dryRun({
|
|
167
|
+
timeout: dryRunTimeout,
|
|
168
|
+
coverageAnalysis: this.options.coverageAnalysis,
|
|
169
|
+
disableBail: this.options.disableBail,
|
|
170
|
+
files: dryRunFiles,
|
|
171
|
+
testFiles,
|
|
172
|
+
});
|
|
173
|
+
const grossTimeMS = this.timer.elapsedMs(INITIAL_TEST_RUN_MARKER);
|
|
174
|
+
const capabilities = await testRunner.capabilities();
|
|
175
|
+
this.validateResultCompleted(result);
|
|
176
|
+
|
|
177
|
+
this.remapSandboxFilesToOriginalFiles(result);
|
|
178
|
+
const timing = this.calculateTiming(grossTimeMS, result.tests);
|
|
179
|
+
const dryRunCompleted = { result, timing, capabilities };
|
|
180
|
+
this.reporter.onDryRunCompleted(dryRunCompleted);
|
|
181
|
+
return dryRunCompleted;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Remaps test files to their respective original names outside the sandbox.
|
|
186
|
+
* @param dryRunResult the completed result
|
|
187
|
+
*/
|
|
188
|
+
private remapSandboxFilesToOriginalFiles(dryRunResult: CompleteDryRunResult) {
|
|
189
|
+
const disableTypeCheckingFileMatcher = new FileMatcher(
|
|
190
|
+
this.options.disableTypeChecks,
|
|
191
|
+
);
|
|
192
|
+
dryRunResult.tests.forEach((test) => {
|
|
193
|
+
if (test.fileName) {
|
|
194
|
+
test.fileName = this.sandbox.originalFileFor(test.fileName);
|
|
195
|
+
|
|
196
|
+
// HACK line numbers of the tests can be offset by 1 because the disable type checks preprocessor could have added a `// @ts-nocheck` line.
|
|
197
|
+
// We correct for that here if needed
|
|
198
|
+
// If we do more complex stuff in sandbox preprocessing in the future, we might want to add a robust remapping logic
|
|
199
|
+
if (
|
|
200
|
+
test.startPosition &&
|
|
201
|
+
disableTypeCheckingFileMatcher.matches(test.fileName)
|
|
202
|
+
) {
|
|
203
|
+
test.startPosition.line--;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private logInitialTestRunSucceeded(tests: TestResult[], timing: RunTiming) {
|
|
210
|
+
if (!tests.length) {
|
|
211
|
+
this.log.info('No tests were found');
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
this.log.info(
|
|
216
|
+
'Initial test run succeeded. Ran %s tests in %s (net %s ms, overhead %s ms).',
|
|
217
|
+
tests.length,
|
|
218
|
+
this.timer.humanReadableElapsed(INITIAL_TEST_RUN_MARKER),
|
|
219
|
+
timing.net,
|
|
220
|
+
timing.overhead,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Calculates the timing variables for the test run.
|
|
226
|
+
* grossTime = NetTime + overheadTime
|
|
227
|
+
*
|
|
228
|
+
* The overhead time is used to calculate exact timeout values during mutation testing.
|
|
229
|
+
* See timeoutMS setting in README for more information on this calculation
|
|
230
|
+
*/
|
|
231
|
+
private calculateTiming(
|
|
232
|
+
grossTimeMS: number,
|
|
233
|
+
tests: readonly TestResult[],
|
|
234
|
+
): RunTiming {
|
|
235
|
+
const netTimeMS = tests.reduce(
|
|
236
|
+
(total, test) => total + test.timeSpentMs,
|
|
237
|
+
0,
|
|
238
|
+
);
|
|
239
|
+
const overheadTimeMS = grossTimeMS - netTimeMS;
|
|
240
|
+
return {
|
|
241
|
+
net: netTimeMS,
|
|
242
|
+
overhead: overheadTimeMS < 0 ? 0 : overheadTimeMS,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private logFailedTestsInInitialRun(failedTests: FailedTestResult[]): void {
|
|
247
|
+
let message = 'One or more tests failed in the initial test run:';
|
|
248
|
+
failedTests.forEach((test) => {
|
|
249
|
+
message += `${EOL}\t${test.name}`;
|
|
250
|
+
message += `${EOL}\t\t${test.failureMessage}`;
|
|
251
|
+
});
|
|
252
|
+
this.log.error(message);
|
|
253
|
+
}
|
|
254
|
+
private logErrorsInInitialRun(runResult: ErrorDryRunResult) {
|
|
255
|
+
const message = `One or more tests resulted in an error:${EOL}\t${runResult.errorMessage}`;
|
|
256
|
+
this.log.error(message);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private logTimeoutInitialRun() {
|
|
260
|
+
this.log.error('Initial test run timed out!');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import {
|
|
2
|
+
from,
|
|
3
|
+
partition,
|
|
4
|
+
merge,
|
|
5
|
+
Observable,
|
|
6
|
+
lastValueFrom,
|
|
7
|
+
EMPTY,
|
|
8
|
+
concat,
|
|
9
|
+
bufferTime,
|
|
10
|
+
mergeMap,
|
|
11
|
+
} from 'rxjs';
|
|
12
|
+
import { toArray, map, shareReplay, tap } from 'rxjs/operators';
|
|
13
|
+
import { tokens, commonTokens } from '@stryker-mutator/api/plugin';
|
|
14
|
+
import {
|
|
15
|
+
MutantResult,
|
|
16
|
+
Mutant,
|
|
17
|
+
StrykerOptions,
|
|
18
|
+
PlanKind,
|
|
19
|
+
MutantTestPlan,
|
|
20
|
+
MutantRunPlan,
|
|
21
|
+
} from '@stryker-mutator/api/core';
|
|
22
|
+
import {
|
|
23
|
+
TestRunner,
|
|
24
|
+
CompleteDryRunResult,
|
|
25
|
+
} from '@stryker-mutator/api/test-runner';
|
|
26
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
27
|
+
import { I } from '@stryker-mutator/util';
|
|
28
|
+
import { CheckStatus } from '@stryker-mutator/api/check';
|
|
29
|
+
|
|
30
|
+
import { coreTokens } from '../di/index.js';
|
|
31
|
+
import { StrictReporter } from '../reporters/strict-reporter.js';
|
|
32
|
+
import { MutationTestReportHelper } from '../reporters/mutation-test-report-helper.js';
|
|
33
|
+
import { Timer } from '../utils/timer.js';
|
|
34
|
+
import { ConcurrencyTokenProvider, Pool } from '../concurrent/index.js';
|
|
35
|
+
import { isEarlyResult, MutantTestPlanner } from '../mutants/index.js';
|
|
36
|
+
import { CheckerFacade } from '../checker/index.js';
|
|
37
|
+
|
|
38
|
+
import { DryRunContext } from './3-dry-run-executor.js';
|
|
39
|
+
|
|
40
|
+
export interface MutationTestContext extends DryRunContext {
|
|
41
|
+
[coreTokens.testRunnerPool]: I<Pool<TestRunner>>;
|
|
42
|
+
[coreTokens.timeOverheadMS]: number;
|
|
43
|
+
[coreTokens.mutationTestReportHelper]: MutationTestReportHelper;
|
|
44
|
+
[coreTokens.mutantTestPlanner]: MutantTestPlanner;
|
|
45
|
+
[coreTokens.dryRunResult]: I<CompleteDryRunResult>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const CHECK_BUFFER_MS = 10_000;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Sorting the tests just before running them can yield a significant performance boost,
|
|
52
|
+
* because it can reduce the number of times a test runner process needs to be recreated.
|
|
53
|
+
* However, we need to buffer the results in order to be able to sort them.
|
|
54
|
+
*
|
|
55
|
+
* This value is very low, since it would halt the test execution otherwise.
|
|
56
|
+
* @see https://github.com/stryker-mutator/stryker-js/issues/3462
|
|
57
|
+
*/
|
|
58
|
+
const BUFFER_FOR_SORTING_MS = 0;
|
|
59
|
+
|
|
60
|
+
export class MutationTestExecutor {
|
|
61
|
+
public static inject = tokens(
|
|
62
|
+
coreTokens.reporter,
|
|
63
|
+
coreTokens.testRunnerPool,
|
|
64
|
+
coreTokens.checkerPool,
|
|
65
|
+
coreTokens.mutants,
|
|
66
|
+
coreTokens.mutantTestPlanner,
|
|
67
|
+
coreTokens.mutationTestReportHelper,
|
|
68
|
+
commonTokens.logger,
|
|
69
|
+
commonTokens.options,
|
|
70
|
+
coreTokens.timer,
|
|
71
|
+
coreTokens.concurrencyTokenProvider,
|
|
72
|
+
coreTokens.dryRunResult,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
constructor(
|
|
76
|
+
private readonly reporter: StrictReporter,
|
|
77
|
+
private readonly testRunnerPool: I<Pool<TestRunner>>,
|
|
78
|
+
private readonly checkerPool: I<Pool<I<CheckerFacade>>>,
|
|
79
|
+
private readonly mutants: readonly Mutant[],
|
|
80
|
+
private readonly planner: MutantTestPlanner,
|
|
81
|
+
private readonly mutationTestReportHelper: I<MutationTestReportHelper>,
|
|
82
|
+
private readonly log: Logger,
|
|
83
|
+
private readonly options: StrykerOptions,
|
|
84
|
+
private readonly timer: I<Timer>,
|
|
85
|
+
private readonly concurrencyTokenProvider: I<ConcurrencyTokenProvider>,
|
|
86
|
+
private readonly dryRunResult: CompleteDryRunResult,
|
|
87
|
+
) {}
|
|
88
|
+
|
|
89
|
+
public async execute(): Promise<MutantResult[]> {
|
|
90
|
+
if (this.options.dryRunOnly) {
|
|
91
|
+
this.log.info(
|
|
92
|
+
'The dry-run has been completed successfully. No mutations have been executed.',
|
|
93
|
+
);
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.dryRunResult.tests.length === 0 && this.options.allowEmpty) {
|
|
98
|
+
this.logDone();
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const mutantTestPlans = await this.planner.makePlan(this.mutants);
|
|
103
|
+
const { earlyResult$, runMutant$ } = this.executeEarlyResult(
|
|
104
|
+
from(mutantTestPlans),
|
|
105
|
+
);
|
|
106
|
+
const { passedMutant$, checkResult$ } = this.executeCheck(runMutant$);
|
|
107
|
+
const { coveredMutant$, noCoverageResult$ } =
|
|
108
|
+
this.executeNoCoverage(passedMutant$);
|
|
109
|
+
const testRunnerResult$ = this.executeRunInTestRunner(coveredMutant$);
|
|
110
|
+
const results = await lastValueFrom(
|
|
111
|
+
merge(
|
|
112
|
+
testRunnerResult$,
|
|
113
|
+
checkResult$,
|
|
114
|
+
noCoverageResult$,
|
|
115
|
+
earlyResult$,
|
|
116
|
+
).pipe(toArray()),
|
|
117
|
+
);
|
|
118
|
+
await this.mutationTestReportHelper.reportAll(results);
|
|
119
|
+
await this.reporter.wrapUp();
|
|
120
|
+
this.logDone();
|
|
121
|
+
return results;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private executeEarlyResult(input$: Observable<MutantTestPlan>) {
|
|
125
|
+
const [earlyResultMutants$, runMutant$] = partition(
|
|
126
|
+
input$.pipe(shareReplay()),
|
|
127
|
+
isEarlyResult,
|
|
128
|
+
);
|
|
129
|
+
const earlyResult$ = earlyResultMutants$.pipe(
|
|
130
|
+
map(({ mutant }) =>
|
|
131
|
+
this.mutationTestReportHelper.reportMutantStatus(mutant, mutant.status),
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
|
+
return { earlyResult$, runMutant$ };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private executeNoCoverage(input$: Observable<MutantRunPlan>) {
|
|
138
|
+
const [noCoverageMatchedMutant$, coveredMutant$] = partition(
|
|
139
|
+
input$.pipe(shareReplay()),
|
|
140
|
+
({ runOptions }) => runOptions.testFilter?.length === 0,
|
|
141
|
+
);
|
|
142
|
+
const noCoverageResult$ = noCoverageMatchedMutant$.pipe(
|
|
143
|
+
map(({ mutant }) =>
|
|
144
|
+
this.mutationTestReportHelper.reportMutantStatus(mutant, 'NoCoverage'),
|
|
145
|
+
),
|
|
146
|
+
);
|
|
147
|
+
return { noCoverageResult$, coveredMutant$ };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private executeRunInTestRunner(
|
|
151
|
+
input$: Observable<MutantRunPlan>,
|
|
152
|
+
): Observable<MutantResult> {
|
|
153
|
+
const sortedPlan$ = input$.pipe(
|
|
154
|
+
bufferTime(BUFFER_FOR_SORTING_MS),
|
|
155
|
+
mergeMap((plans) => plans.sort(reloadEnvironmentLast)),
|
|
156
|
+
);
|
|
157
|
+
return this.testRunnerPool.schedule(
|
|
158
|
+
sortedPlan$,
|
|
159
|
+
async (testRunner, { mutant, runOptions }) => {
|
|
160
|
+
const result = await testRunner.mutantRun(runOptions);
|
|
161
|
+
return this.mutationTestReportHelper.reportMutantRunResult(
|
|
162
|
+
mutant,
|
|
163
|
+
result,
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private logDone() {
|
|
170
|
+
this.log.info('Done in %s.', this.timer.humanReadableElapsed());
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Checks mutants against all configured checkers (if any) and returns steams for failed checks and passed checks respectively
|
|
175
|
+
* @param input$ The mutant run plans to check
|
|
176
|
+
*/
|
|
177
|
+
public executeCheck(input$: Observable<MutantRunPlan>): {
|
|
178
|
+
checkResult$: Observable<MutantResult>;
|
|
179
|
+
passedMutant$: Observable<MutantRunPlan>;
|
|
180
|
+
} {
|
|
181
|
+
let checkResult$: Observable<MutantResult> = EMPTY;
|
|
182
|
+
let passedMutant$ = input$;
|
|
183
|
+
for (const checkerName of this.options.checkers) {
|
|
184
|
+
// Use this checker
|
|
185
|
+
const [checkFailedResult$, checkPassedResult$] = partition(
|
|
186
|
+
this.executeSingleChecker(checkerName, passedMutant$).pipe(
|
|
187
|
+
shareReplay(),
|
|
188
|
+
),
|
|
189
|
+
isEarlyResult,
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
// Prepare for the next one
|
|
193
|
+
passedMutant$ = checkPassedResult$;
|
|
194
|
+
checkResult$ = concat(
|
|
195
|
+
checkResult$,
|
|
196
|
+
checkFailedResult$.pipe(map(({ mutant }) => mutant)),
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
checkResult$,
|
|
201
|
+
passedMutant$: passedMutant$.pipe(
|
|
202
|
+
tap({
|
|
203
|
+
complete: () => {
|
|
204
|
+
this.checkerPool
|
|
205
|
+
.dispose()
|
|
206
|
+
.then(() => {
|
|
207
|
+
this.concurrencyTokenProvider.freeCheckers();
|
|
208
|
+
})
|
|
209
|
+
.catch((error) => {
|
|
210
|
+
this.log.error(
|
|
211
|
+
'An error occurred while disposing checkers: %s',
|
|
212
|
+
error,
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
217
|
+
),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Executes the check task for one checker
|
|
223
|
+
* @param checkerName The name of the checker to execute
|
|
224
|
+
* @param input$ The mutants tasks to check
|
|
225
|
+
* @returns An observable stream with early results (check failed) and passed results
|
|
226
|
+
*/
|
|
227
|
+
private executeSingleChecker(
|
|
228
|
+
checkerName: string,
|
|
229
|
+
input$: Observable<MutantRunPlan>,
|
|
230
|
+
): Observable<MutantTestPlan> {
|
|
231
|
+
const group$ = this.checkerPool
|
|
232
|
+
.schedule(input$.pipe(bufferTime(CHECK_BUFFER_MS)), (checker, mutants) =>
|
|
233
|
+
checker.group(checkerName, mutants),
|
|
234
|
+
)
|
|
235
|
+
.pipe(mergeMap((mutantGroups) => mutantGroups));
|
|
236
|
+
const checkTask$ = this.checkerPool
|
|
237
|
+
.schedule(group$, (checker, group) => checker.check(checkerName, group))
|
|
238
|
+
.pipe(
|
|
239
|
+
mergeMap((mutantGroupResults) => mutantGroupResults),
|
|
240
|
+
map(([mutantRunPlan, checkResult]) =>
|
|
241
|
+
checkResult.status === CheckStatus.Passed
|
|
242
|
+
? mutantRunPlan
|
|
243
|
+
: {
|
|
244
|
+
plan: PlanKind.EarlyResult as const,
|
|
245
|
+
mutant: this.mutationTestReportHelper.reportCheckFailed(
|
|
246
|
+
mutantRunPlan.mutant,
|
|
247
|
+
checkResult,
|
|
248
|
+
),
|
|
249
|
+
},
|
|
250
|
+
),
|
|
251
|
+
);
|
|
252
|
+
return checkTask$;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Sorting function that sorts mutant run plans that reload environments last.
|
|
258
|
+
* This can yield a significant performance boost, because it reduces the times a test runner process needs to restart.
|
|
259
|
+
* @see https://github.com/stryker-mutator/stryker-js/issues/3462
|
|
260
|
+
*/
|
|
261
|
+
function reloadEnvironmentLast(a: MutantRunPlan, b: MutantRunPlan): number {
|
|
262
|
+
if (a.plan === PlanKind.Run && b.plan === PlanKind.Run) {
|
|
263
|
+
if (a.runOptions.reloadEnvironment && !b.runOptions.reloadEnvironment) {
|
|
264
|
+
return 1;
|
|
265
|
+
}
|
|
266
|
+
if (!a.runOptions.reloadEnvironment && b.runOptions.reloadEnvironment) {
|
|
267
|
+
return -1;
|
|
268
|
+
}
|
|
269
|
+
return 0;
|
|
270
|
+
}
|
|
271
|
+
return 0;
|
|
272
|
+
}
|