@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,87 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
|
|
6
|
+
import { schema, StrykerOptions } from '@stryker-mutator/api/core';
|
|
7
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
8
|
+
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
9
|
+
import { Reporter } from '@stryker-mutator/api/report';
|
|
10
|
+
|
|
11
|
+
import { pathToFileURL } from 'url';
|
|
12
|
+
import { reporterUtil } from './reporter-util.js';
|
|
13
|
+
|
|
14
|
+
export class HtmlReporter implements Reporter {
|
|
15
|
+
private mainPromise: Promise<void> | undefined;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private readonly options: StrykerOptions,
|
|
19
|
+
private readonly log: Logger,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
public static readonly inject = tokens(
|
|
23
|
+
commonTokens.options,
|
|
24
|
+
commonTokens.logger,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
public onMutationTestReportReady(report: schema.MutationTestResult): void {
|
|
28
|
+
this.mainPromise = this.generateReport(report);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public wrapUp(): Promise<void> | undefined {
|
|
32
|
+
return this.mainPromise;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private async generateReport(report: schema.MutationTestResult) {
|
|
36
|
+
this.log.debug(`Using file "${this.options.htmlReporter.fileName}"`);
|
|
37
|
+
const html = await createReportHtml(report);
|
|
38
|
+
await reporterUtil.writeFile(this.options.htmlReporter.fileName, html);
|
|
39
|
+
this.log.info(
|
|
40
|
+
`Your report can be found at: ${pathToFileURL(path.resolve(this.options.htmlReporter.fileName)).href}`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function createReportHtml(
|
|
46
|
+
report: schema.MutationTestResult,
|
|
47
|
+
): Promise<string> {
|
|
48
|
+
const require = createRequire(import.meta.url);
|
|
49
|
+
const scriptContent = await fs.promises.readFile(
|
|
50
|
+
require.resolve('mutation-testing-elements/dist/mutation-test-elements.js'),
|
|
51
|
+
'utf-8',
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return `<!DOCTYPE html>
|
|
55
|
+
<html>
|
|
56
|
+
<head>
|
|
57
|
+
<meta charset="utf-8">
|
|
58
|
+
<script>
|
|
59
|
+
${scriptContent}
|
|
60
|
+
</script>
|
|
61
|
+
</head>
|
|
62
|
+
<body>
|
|
63
|
+
<svg style="width: 80px; position:fixed; right:10px; bottom:10px; z-index:10" class="stryker-image" viewBox="0 0 1458 1458" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path fill="none" d="M0 0h1458v1458H0z"/><clipPath id="a"><path d="M0 0h1458v1458H0z"/></clipPath><g clip-path="url(#a)"><path d="M1458 729c0 402.655-326.345 729-729 729S0 1131.655 0 729C0 326.445 326.345 0 729 0s729 326.345 729 729" fill="#e74c3c" fill-rule="nonzero"/><path d="M778.349 1456.15L576.6 1254.401l233-105 85-78.668v-64.332l-257-257-44-187-50-208 251.806-82.793L1076.6 389.401l380.14 379.15c-19.681 367.728-311.914 663.049-678.391 687.599z" fill-opacity=".3"/><path d="M753.4 329.503c41.79 0 74.579 7.83 97.925 25.444 23.571 18.015 41.69 43.956 55.167 77.097l11.662 28.679 165.733-58.183-14.137-32.13c-26.688-60.655-64.896-108.61-114.191-144.011-49.329-35.423-117.458-54.302-204.859-54.302-50.78 0-95.646 7.376-134.767 21.542-40.093 14.671-74.09 34.79-102.239 60.259-28.84 26.207-50.646 57.06-65.496 92.701-14.718 35.052-22.101 72.538-22.101 112.401 0 72.536 20.667 133.294 61.165 182.704 38.624 47.255 98.346 88.037 179.861 121.291 42.257 17.475 78.715 33.125 109.227 46.994 27.193 12.361 49.294 26.124 66.157 41.751 15.309 14.186 26.497 30.584 33.63 49.258 7.721 20.214 11.16 45.69 11.16 76.402 0 28.021-4.251 51.787-13.591 71.219-8.832 18.374-20.171 33.178-34.523 44.219-14.787 11.374-31.193 19.591-49.393 24.466-19.68 5.359-39.14 7.993-58.69 7.993-29.359 0-54.387-3.407-75.182-10.747-20.112-7.013-37.144-16.144-51.259-27.486-13.618-11.009-24.971-23.766-33.744-38.279-9.64-15.8-17.272-31.924-23.032-48.408l-10.965-31.376-161.669 60.585 10.734 30.124c10.191 28.601 24.197 56.228 42.059 82.748 18.208 27.144 41.322 51.369 69.525 72.745 27.695 21.075 60.904 38.218 99.481 51.041 37.777 12.664 82.004 19.159 132.552 19.159 49.998 0 95.818-8.321 137.611-24.622 42.228-16.471 78.436-38.992 108.835-67.291 30.719-28.597 54.631-62.103 71.834-100.642 17.263-38.56 25.923-79.392 25.923-122.248 0-54.339-8.368-100.37-24.208-138.32-16.29-38.759-38.252-71.661-65.948-98.797-26.965-26.418-58.269-48.835-93.858-67.175-33.655-17.241-69.196-33.11-106.593-47.533-35.934-13.429-65.822-26.601-89.948-39.525-22.153-11.868-40.009-24.21-53.547-37.309-11.429-11.13-19.83-23.678-24.718-37.664-5.413-15.49-7.98-33.423-7.98-53.577 0-40.883 11.293-71.522 37.086-90.539 28.443-20.825 64.985-30.658 109.311-30.658z" fill="#f1c40f" fill-rule="nonzero"/><path d="M720 0h18v113h-18zM1458 738v-18h-113v18h113zM720 1345h18v113h-18zM113 738v-18H0v18h113z"/></g></svg>
|
|
64
|
+
<mutation-test-report-app titlePostfix="Stryker">
|
|
65
|
+
Your browser doesn't support <a href="https://caniuse.com/#search=custom%20elements">custom elements</a>.
|
|
66
|
+
Please use a latest version of an evergreen browser (Firefox, Chrome, Safari, Opera, Edge, etc).
|
|
67
|
+
</mutation-test-report-app>
|
|
68
|
+
<script>
|
|
69
|
+
const app = document.querySelector('mutation-test-report-app');
|
|
70
|
+
app.report = ${escapeHtmlTags(JSON.stringify(report))};
|
|
71
|
+
function updateTheme() {
|
|
72
|
+
document.body.style.backgroundColor = app.themeBackgroundColor;
|
|
73
|
+
}
|
|
74
|
+
app.addEventListener('theme-changed', updateTheme);
|
|
75
|
+
updateTheme();
|
|
76
|
+
</script>
|
|
77
|
+
</body>
|
|
78
|
+
</html>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Escapes the HTML tags inside strings in a JSON input by breaking them apart.
|
|
83
|
+
*/
|
|
84
|
+
function escapeHtmlTags(json: string) {
|
|
85
|
+
const j = json.replace(/</g, '<"+"');
|
|
86
|
+
return j;
|
|
87
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
declareClassPlugin,
|
|
3
|
+
declareFactoryPlugin,
|
|
4
|
+
PluginKind,
|
|
5
|
+
} from '@stryker-mutator/api/plugin';
|
|
6
|
+
|
|
7
|
+
import { ClearTextReporter } from './clear-text-reporter.js';
|
|
8
|
+
import { dashboardReporterFactory } from './dashboard-reporter/index.js';
|
|
9
|
+
import { DotsReporter } from './dots-reporter.js';
|
|
10
|
+
import { EventRecorderReporter } from './event-recorder-reporter.js';
|
|
11
|
+
import { ProgressAppendOnlyReporter } from './progress-append-only-reporter.js';
|
|
12
|
+
import { ProgressBarReporter } from './progress-reporter.js';
|
|
13
|
+
import { HtmlReporter } from './html-reporter.js';
|
|
14
|
+
import { JsonReporter } from './json-reporter.js';
|
|
15
|
+
import { MutationTimingsReporter } from './mutation-timings-reporter.js';
|
|
16
|
+
|
|
17
|
+
export { BroadcastReporter } from './broadcast-reporter.js';
|
|
18
|
+
export type { StrictReporter } from './strict-reporter.js';
|
|
19
|
+
|
|
20
|
+
export const strykerPlugins = [
|
|
21
|
+
declareClassPlugin(PluginKind.Reporter, 'clear-text', ClearTextReporter),
|
|
22
|
+
declareClassPlugin(PluginKind.Reporter, 'progress', ProgressBarReporter),
|
|
23
|
+
declareClassPlugin(
|
|
24
|
+
PluginKind.Reporter,
|
|
25
|
+
'progress-append-only',
|
|
26
|
+
ProgressAppendOnlyReporter,
|
|
27
|
+
),
|
|
28
|
+
declareClassPlugin(PluginKind.Reporter, 'dots', DotsReporter),
|
|
29
|
+
declareClassPlugin(
|
|
30
|
+
PluginKind.Reporter,
|
|
31
|
+
'event-recorder',
|
|
32
|
+
EventRecorderReporter,
|
|
33
|
+
),
|
|
34
|
+
declareClassPlugin(PluginKind.Reporter, 'html', HtmlReporter),
|
|
35
|
+
declareClassPlugin(PluginKind.Reporter, 'json', JsonReporter),
|
|
36
|
+
declareClassPlugin(
|
|
37
|
+
PluginKind.Reporter,
|
|
38
|
+
'mutation-timings',
|
|
39
|
+
MutationTimingsReporter,
|
|
40
|
+
),
|
|
41
|
+
declareFactoryPlugin(
|
|
42
|
+
PluginKind.Reporter,
|
|
43
|
+
'dashboard',
|
|
44
|
+
dashboardReporterFactory,
|
|
45
|
+
),
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const reporterPluginsFileUrl = import.meta.url;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { schema, StrykerOptions } from '@stryker-mutator/api/core';
|
|
4
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
5
|
+
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
6
|
+
import { Reporter } from '@stryker-mutator/api/report';
|
|
7
|
+
import { pathToFileURL } from 'url';
|
|
8
|
+
import { reporterUtil } from './reporter-util.js';
|
|
9
|
+
|
|
10
|
+
const INDENTION_LEVEL = 0;
|
|
11
|
+
export const RESOURCES_DIR_NAME = 'strykerResources';
|
|
12
|
+
|
|
13
|
+
export class JsonReporter implements Reporter {
|
|
14
|
+
private mainPromise: Promise<void> | undefined;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
private readonly options: StrykerOptions,
|
|
18
|
+
private readonly log: Logger,
|
|
19
|
+
) {}
|
|
20
|
+
|
|
21
|
+
public static readonly inject = tokens(
|
|
22
|
+
commonTokens.options,
|
|
23
|
+
commonTokens.logger,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
public onMutationTestReportReady(report: schema.MutationTestResult): void {
|
|
27
|
+
this.mainPromise = this.generateReport(report);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public wrapUp(): Promise<void> | undefined {
|
|
31
|
+
return this.mainPromise;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private async generateReport(report: schema.MutationTestResult) {
|
|
35
|
+
const filePath = path.normalize(this.options.jsonReporter.fileName);
|
|
36
|
+
this.log.debug(`Using relative path ${filePath}`);
|
|
37
|
+
await reporterUtil.writeFile(
|
|
38
|
+
path.resolve(filePath),
|
|
39
|
+
JSON.stringify(report, null, INDENTION_LEVEL),
|
|
40
|
+
);
|
|
41
|
+
this.log.info(
|
|
42
|
+
`Your report can be found at: ${pathToFileURL(filePath).href}`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
StrykerOptions,
|
|
5
|
+
MutantTestCoverage,
|
|
6
|
+
MutantResult,
|
|
7
|
+
schema,
|
|
8
|
+
MutantStatus,
|
|
9
|
+
} from '@stryker-mutator/api/core';
|
|
10
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
11
|
+
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
12
|
+
import { Reporter } from '@stryker-mutator/api/report';
|
|
13
|
+
import {
|
|
14
|
+
I,
|
|
15
|
+
normalizeFileName,
|
|
16
|
+
normalizeWhitespaces,
|
|
17
|
+
type requireResolve,
|
|
18
|
+
} from '@stryker-mutator/util';
|
|
19
|
+
import {
|
|
20
|
+
calculateMutationTestMetrics,
|
|
21
|
+
MutationTestMetricsResult,
|
|
22
|
+
} from 'mutation-testing-metrics';
|
|
23
|
+
import {
|
|
24
|
+
MutantRunResult,
|
|
25
|
+
MutantRunStatus,
|
|
26
|
+
TestResult,
|
|
27
|
+
} from '@stryker-mutator/api/test-runner';
|
|
28
|
+
import {
|
|
29
|
+
CheckStatus,
|
|
30
|
+
PassedCheckResult,
|
|
31
|
+
CheckResult,
|
|
32
|
+
} from '@stryker-mutator/api/check';
|
|
33
|
+
|
|
34
|
+
import { strykerVersion } from '../stryker-package.js';
|
|
35
|
+
import { coreTokens } from '../di/index.js';
|
|
36
|
+
import { objectUtils } from '../utils/object-utils.js';
|
|
37
|
+
import { Project, FileSystem } from '../fs/index.js';
|
|
38
|
+
import { TestCoverage } from '../mutants/index.js';
|
|
39
|
+
|
|
40
|
+
const STRYKER_FRAMEWORK: Readonly<
|
|
41
|
+
Pick<schema.FrameworkInformation, 'branding' | 'name' | 'version'>
|
|
42
|
+
> = Object.freeze({
|
|
43
|
+
name: 'StrykerJS',
|
|
44
|
+
version: strykerVersion,
|
|
45
|
+
branding: {
|
|
46
|
+
homepageUrl: 'https://stryker-mutator.io',
|
|
47
|
+
imageUrl:
|
|
48
|
+
"data:image/svg+xml;utf8,%3Csvg viewBox='0 0 1458 1458' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' clip-rule='evenodd' stroke-linejoin='round' stroke-miterlimit='2'%3E%3Cpath fill='none' d='M0 0h1458v1458H0z'/%3E%3CclipPath id='a'%3E%3Cpath d='M0 0h1458v1458H0z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M1458 729c0 402.655-326.345 729-729 729S0 1131.655 0 729C0 326.445 326.345 0 729 0s729 326.345 729 729' fill='%23e74c3c' fill-rule='nonzero'/%3E%3Cpath d='M778.349 1456.15L576.6 1254.401l233-105 85-78.668v-64.332l-257-257-44-187-50-208 251.806-82.793L1076.6 389.401l380.14 379.15c-19.681 367.728-311.914 663.049-678.391 687.599z' fill-opacity='.3'/%3E%3Cpath d='M753.4 329.503c41.79 0 74.579 7.83 97.925 25.444 23.571 18.015 41.69 43.956 55.167 77.097l11.662 28.679 165.733-58.183-14.137-32.13c-26.688-60.655-64.896-108.61-114.191-144.011-49.329-35.423-117.458-54.302-204.859-54.302-50.78 0-95.646 7.376-134.767 21.542-40.093 14.671-74.09 34.79-102.239 60.259-28.84 26.207-50.646 57.06-65.496 92.701-14.718 35.052-22.101 72.538-22.101 112.401 0 72.536 20.667 133.294 61.165 182.704 38.624 47.255 98.346 88.037 179.861 121.291 42.257 17.475 78.715 33.125 109.227 46.994 27.193 12.361 49.294 26.124 66.157 41.751 15.309 14.186 26.497 30.584 33.63 49.258 7.721 20.214 11.16 45.69 11.16 76.402 0 28.021-4.251 51.787-13.591 71.219-8.832 18.374-20.171 33.178-34.523 44.219-14.787 11.374-31.193 19.591-49.393 24.466-19.68 5.359-39.14 7.993-58.69 7.993-29.359 0-54.387-3.407-75.182-10.747-20.112-7.013-37.144-16.144-51.259-27.486-13.618-11.009-24.971-23.766-33.744-38.279-9.64-15.8-17.272-31.924-23.032-48.408l-10.965-31.376-161.669 60.585 10.734 30.124c10.191 28.601 24.197 56.228 42.059 82.748 18.208 27.144 41.322 51.369 69.525 72.745 27.695 21.075 60.904 38.218 99.481 51.041 37.777 12.664 82.004 19.159 132.552 19.159 49.998 0 95.818-8.321 137.611-24.622 42.228-16.471 78.436-38.992 108.835-67.291 30.719-28.597 54.631-62.103 71.834-100.642 17.263-38.56 25.923-79.392 25.923-122.248 0-54.339-8.368-100.37-24.208-138.32-16.29-38.759-38.252-71.661-65.948-98.797-26.965-26.418-58.269-48.835-93.858-67.175-33.655-17.241-69.196-33.11-106.593-47.533-35.934-13.429-65.822-26.601-89.948-39.525-22.153-11.868-40.009-24.21-53.547-37.309-11.429-11.13-19.83-23.678-24.718-37.664-5.413-15.49-7.98-33.423-7.98-53.577 0-40.883 11.293-71.522 37.086-90.539 28.443-20.825 64.985-30.658 109.311-30.658z' fill='%23f1c40f' fill-rule='nonzero'/%3E%3Cpath d='M720 0h18v113h-18zM1458 738v-18h-113v18h113zM720 1345h18v113h-18zM113 738v-18H0v18h113z'/%3E%3C/g%3E%3C/svg%3E",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A helper class to convert and report mutants that survived or get killed
|
|
54
|
+
*/
|
|
55
|
+
export class MutationTestReportHelper {
|
|
56
|
+
public static inject = tokens(
|
|
57
|
+
coreTokens.reporter,
|
|
58
|
+
commonTokens.options,
|
|
59
|
+
coreTokens.project,
|
|
60
|
+
commonTokens.logger,
|
|
61
|
+
coreTokens.testCoverage,
|
|
62
|
+
coreTokens.fs,
|
|
63
|
+
coreTokens.requireFromCwd,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
constructor(
|
|
67
|
+
private readonly reporter: Required<Reporter>,
|
|
68
|
+
private readonly options: StrykerOptions,
|
|
69
|
+
private readonly project: Project,
|
|
70
|
+
private readonly log: Logger,
|
|
71
|
+
private readonly testCoverage: I<TestCoverage>,
|
|
72
|
+
private readonly fs: I<FileSystem>,
|
|
73
|
+
private readonly requireFromCwd: typeof requireResolve,
|
|
74
|
+
) {}
|
|
75
|
+
|
|
76
|
+
public reportCheckFailed(
|
|
77
|
+
mutant: MutantTestCoverage,
|
|
78
|
+
checkResult: Exclude<CheckResult, PassedCheckResult>,
|
|
79
|
+
): MutantResult {
|
|
80
|
+
const location = objectUtils.toSchemaLocation(mutant.location);
|
|
81
|
+
return this.reportOne({
|
|
82
|
+
...mutant,
|
|
83
|
+
status: this.checkStatusToResultStatus(checkResult.status),
|
|
84
|
+
statusReason: checkResult.reason,
|
|
85
|
+
location,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public reportMutantStatus(
|
|
90
|
+
mutant: MutantTestCoverage,
|
|
91
|
+
status: MutantStatus,
|
|
92
|
+
): MutantResult {
|
|
93
|
+
const location = objectUtils.toSchemaLocation(mutant.location);
|
|
94
|
+
return this.reportOne({
|
|
95
|
+
...mutant,
|
|
96
|
+
status,
|
|
97
|
+
location,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public reportMutantRunResult(
|
|
102
|
+
mutant: MutantTestCoverage,
|
|
103
|
+
result: MutantRunResult,
|
|
104
|
+
): MutantResult {
|
|
105
|
+
const location = objectUtils.toSchemaLocation(mutant.location);
|
|
106
|
+
|
|
107
|
+
// Prune fields used for Stryker bookkeeping
|
|
108
|
+
switch (result.status) {
|
|
109
|
+
case MutantRunStatus.Error:
|
|
110
|
+
return this.reportOne({
|
|
111
|
+
...mutant,
|
|
112
|
+
status: 'RuntimeError',
|
|
113
|
+
statusReason: result.errorMessage,
|
|
114
|
+
location,
|
|
115
|
+
});
|
|
116
|
+
case MutantRunStatus.Killed:
|
|
117
|
+
return this.reportOne({
|
|
118
|
+
...mutant,
|
|
119
|
+
status: 'Killed',
|
|
120
|
+
testsCompleted: result.nrOfTests,
|
|
121
|
+
killedBy: result.killedBy,
|
|
122
|
+
executedTests: result.executedTests,
|
|
123
|
+
statusReason: result.failureMessage,
|
|
124
|
+
location,
|
|
125
|
+
});
|
|
126
|
+
case MutantRunStatus.Timeout:
|
|
127
|
+
return this.reportOne({
|
|
128
|
+
...mutant,
|
|
129
|
+
status: 'Timeout',
|
|
130
|
+
statusReason: result.reason,
|
|
131
|
+
location,
|
|
132
|
+
});
|
|
133
|
+
case MutantRunStatus.Survived:
|
|
134
|
+
return this.reportOne({
|
|
135
|
+
...mutant,
|
|
136
|
+
status: 'Survived',
|
|
137
|
+
testsCompleted: result.nrOfTests,
|
|
138
|
+
executedTests: result.executedTests,
|
|
139
|
+
location,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private reportOne(result: MutantResult): MutantResult {
|
|
145
|
+
this.reporter.onMutantTested(result);
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private checkStatusToResultStatus(
|
|
150
|
+
status: Exclude<CheckStatus, CheckStatus.Passed>,
|
|
151
|
+
): MutantStatus {
|
|
152
|
+
switch (status) {
|
|
153
|
+
case CheckStatus.CompileError:
|
|
154
|
+
return 'CompileError';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public async reportAll(results: MutantResult[]): Promise<void> {
|
|
159
|
+
const report = await this.mutationTestReport(results);
|
|
160
|
+
const metrics = calculateMutationTestMetrics(report);
|
|
161
|
+
this.reporter.onMutationTestReportReady(report, metrics);
|
|
162
|
+
if (this.options.incremental) {
|
|
163
|
+
await this.fs.mkdir(path.dirname(this.options.incrementalFile), {
|
|
164
|
+
recursive: true,
|
|
165
|
+
});
|
|
166
|
+
await this.fs.writeFile(
|
|
167
|
+
this.options.incrementalFile,
|
|
168
|
+
JSON.stringify(report, null, 2),
|
|
169
|
+
'utf-8',
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
this.determineExitCode(metrics);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private determineExitCode(metrics: MutationTestMetricsResult) {
|
|
176
|
+
const { mutationScore } = metrics.systemUnderTestMetrics.metrics;
|
|
177
|
+
const breaking = this.options.thresholds.break;
|
|
178
|
+
const formattedScore = mutationScore.toFixed(2);
|
|
179
|
+
if (typeof breaking === 'number') {
|
|
180
|
+
if (mutationScore < breaking) {
|
|
181
|
+
this.log.error(
|
|
182
|
+
`Final mutation score ${formattedScore} under breaking threshold ${breaking}, setting exit code to 1 (failure).`,
|
|
183
|
+
);
|
|
184
|
+
this.log.info(
|
|
185
|
+
'(improve mutation score or set `thresholds.break = null` to prevent this error in the future)',
|
|
186
|
+
);
|
|
187
|
+
objectUtils.setExitCode(1);
|
|
188
|
+
} else {
|
|
189
|
+
this.log.info(
|
|
190
|
+
`Final mutation score of ${formattedScore} is greater than or equal to break threshold ${breaking}`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
this.log.debug(
|
|
195
|
+
"No breaking threshold configured. Won't fail the build no matter how low your mutation score is. Set `thresholds.break` to change this behavior.",
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private async mutationTestReport(
|
|
201
|
+
results: readonly MutantResult[],
|
|
202
|
+
): Promise<schema.MutationTestResult> {
|
|
203
|
+
// Mocha, jest and karma use test titles as test ids.
|
|
204
|
+
// This can mean a lot of duplicate strings in the json report.
|
|
205
|
+
// Therefore we remap the test ids here to numbers.
|
|
206
|
+
const testIdMap = new Map(
|
|
207
|
+
[...this.testCoverage.testsById.values()].map((test, index) => [
|
|
208
|
+
test.id,
|
|
209
|
+
index.toString(),
|
|
210
|
+
]),
|
|
211
|
+
);
|
|
212
|
+
const remapTestId = (id: string): string => testIdMap.get(id) ?? id;
|
|
213
|
+
const remapTestIds = (ids: string[] | undefined): string[] | undefined =>
|
|
214
|
+
ids?.map(remapTestId);
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
files: await this.toFileResults(results, remapTestIds),
|
|
218
|
+
schemaVersion: '1.0',
|
|
219
|
+
thresholds: this.options.thresholds,
|
|
220
|
+
testFiles: await this.toTestFiles(remapTestId),
|
|
221
|
+
projectRoot: process.cwd(),
|
|
222
|
+
config: this.options,
|
|
223
|
+
framework: {
|
|
224
|
+
...STRYKER_FRAMEWORK,
|
|
225
|
+
dependencies: this.discoverDependencies(),
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private async toFileResults(
|
|
231
|
+
results: readonly MutantResult[],
|
|
232
|
+
remapTestIds: (ids: string[] | undefined) => string[] | undefined,
|
|
233
|
+
): Promise<schema.FileResultDictionary> {
|
|
234
|
+
const fileResultsByName = new Map<string, schema.FileResult>(
|
|
235
|
+
await Promise.all(
|
|
236
|
+
[...new Set(results.map(({ fileName }) => fileName))].map(
|
|
237
|
+
async (fileName) =>
|
|
238
|
+
[fileName, await this.toFileResult(fileName)] as const,
|
|
239
|
+
),
|
|
240
|
+
),
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
return results.reduce<schema.FileResultDictionary>((acc, mutantResult) => {
|
|
244
|
+
const reportFileName = normalizeReportFileName(mutantResult.fileName);
|
|
245
|
+
const fileResult =
|
|
246
|
+
acc[reportFileName] ??
|
|
247
|
+
(acc[reportFileName] = fileResultsByName.get(mutantResult.fileName)!);
|
|
248
|
+
fileResult.mutants.push(this.toMutantResult(mutantResult, remapTestIds));
|
|
249
|
+
return acc;
|
|
250
|
+
}, {});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
private async toTestFiles(
|
|
254
|
+
remapTestId: (id: string) => string,
|
|
255
|
+
): Promise<schema.TestFileDefinitionDictionary> {
|
|
256
|
+
const testFilesByName = new Map<string, schema.TestFile>(
|
|
257
|
+
await Promise.all(
|
|
258
|
+
[
|
|
259
|
+
...new Set(
|
|
260
|
+
[...this.testCoverage.testsById.values()].map(
|
|
261
|
+
({ fileName }) => fileName,
|
|
262
|
+
),
|
|
263
|
+
),
|
|
264
|
+
].map(
|
|
265
|
+
async (fileName) =>
|
|
266
|
+
[
|
|
267
|
+
normalizeReportFileName(fileName),
|
|
268
|
+
await this.toTestFile(fileName),
|
|
269
|
+
] as const,
|
|
270
|
+
),
|
|
271
|
+
),
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
return [
|
|
275
|
+
...this.testCoverage.testsById.values(),
|
|
276
|
+
].reduce<schema.TestFileDefinitionDictionary>((acc, testResult) => {
|
|
277
|
+
const test = this.toTestDefinition(testResult, remapTestId);
|
|
278
|
+
const reportFileName = normalizeReportFileName(testResult.fileName);
|
|
279
|
+
const testFile =
|
|
280
|
+
acc[reportFileName] ??
|
|
281
|
+
(acc[reportFileName] = testFilesByName.get(reportFileName)!);
|
|
282
|
+
testFile.tests.push(test);
|
|
283
|
+
return acc;
|
|
284
|
+
}, {});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
private async toFileResult(fileName: string): Promise<schema.FileResult> {
|
|
288
|
+
const fileResult: schema.FileResult = {
|
|
289
|
+
language: this.determineLanguage(fileName),
|
|
290
|
+
mutants: [],
|
|
291
|
+
source: '',
|
|
292
|
+
};
|
|
293
|
+
const sourceFile = this.project.files.get(fileName);
|
|
294
|
+
if (sourceFile) {
|
|
295
|
+
fileResult.source = await sourceFile.readOriginal();
|
|
296
|
+
} else {
|
|
297
|
+
this.log.warn(
|
|
298
|
+
normalizeWhitespaces(`File "${fileName}" not found
|
|
299
|
+
in input files, but did receive mutant result for it. This shouldn't happen`),
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
return fileResult;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private async toTestFile(
|
|
306
|
+
fileName: string | undefined,
|
|
307
|
+
): Promise<schema.TestFile> {
|
|
308
|
+
const testFile: schema.TestFile = { tests: [] };
|
|
309
|
+
if (fileName) {
|
|
310
|
+
const file = this.project.files.get(fileName);
|
|
311
|
+
if (file) {
|
|
312
|
+
testFile.source = await file.readOriginal();
|
|
313
|
+
} else {
|
|
314
|
+
this.log.warn(
|
|
315
|
+
normalizeWhitespaces(`Test file "${fileName}" not found
|
|
316
|
+
in input files, but did receive test result for it. This shouldn't happen.`),
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return testFile;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
private toTestDefinition(
|
|
324
|
+
test: TestResult,
|
|
325
|
+
remapTestId: (id: string) => string,
|
|
326
|
+
): schema.TestDefinition {
|
|
327
|
+
return {
|
|
328
|
+
id: remapTestId(test.id),
|
|
329
|
+
name: test.name,
|
|
330
|
+
location: test.startPosition
|
|
331
|
+
? { start: objectUtils.toSchemaPosition(test.startPosition) }
|
|
332
|
+
: undefined,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
private determineLanguage(name: string): string {
|
|
337
|
+
const ext = path.extname(name).toLowerCase();
|
|
338
|
+
switch (ext) {
|
|
339
|
+
case '.ts':
|
|
340
|
+
case '.tsx':
|
|
341
|
+
return 'typescript';
|
|
342
|
+
case '.html':
|
|
343
|
+
case '.vue':
|
|
344
|
+
return 'html';
|
|
345
|
+
default:
|
|
346
|
+
return 'javascript';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
private toMutantResult(
|
|
351
|
+
mutantResult: MutantResult,
|
|
352
|
+
remapTestIds: (ids: string[] | undefined) => string[] | undefined,
|
|
353
|
+
): schema.MutantResult {
|
|
354
|
+
const {
|
|
355
|
+
fileName,
|
|
356
|
+
location,
|
|
357
|
+
killedBy,
|
|
358
|
+
coveredBy,
|
|
359
|
+
executedTests: _executedTests,
|
|
360
|
+
...apiMutant
|
|
361
|
+
} = mutantResult;
|
|
362
|
+
return {
|
|
363
|
+
...apiMutant,
|
|
364
|
+
killedBy: remapTestIds(killedBy),
|
|
365
|
+
coveredBy: remapTestIds(coveredBy),
|
|
366
|
+
location,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
private discoverDependencies(): schema.Dependencies {
|
|
371
|
+
const discover = (specifier: string) => {
|
|
372
|
+
try {
|
|
373
|
+
return [
|
|
374
|
+
specifier,
|
|
375
|
+
(
|
|
376
|
+
this.requireFromCwd(`${specifier}/package.json`) as {
|
|
377
|
+
version: string;
|
|
378
|
+
}
|
|
379
|
+
).version,
|
|
380
|
+
];
|
|
381
|
+
} catch {
|
|
382
|
+
// package does not exist...
|
|
383
|
+
return undefined;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const dependencies = [
|
|
387
|
+
'@stryker-mutator/mocha-runner',
|
|
388
|
+
'@stryker-mutator/karma-runner',
|
|
389
|
+
'@stryker-mutator/jasmine-runner',
|
|
390
|
+
'@stryker-mutator/jest-runner',
|
|
391
|
+
'@stryker-mutator/typescript-checker',
|
|
392
|
+
'karma',
|
|
393
|
+
'karma-chai',
|
|
394
|
+
'karma-chrome-launcher',
|
|
395
|
+
'karma-jasmine',
|
|
396
|
+
'karma-mocha',
|
|
397
|
+
'mocha',
|
|
398
|
+
'jasmine',
|
|
399
|
+
'jasmine-core',
|
|
400
|
+
'jest',
|
|
401
|
+
'react-scripts',
|
|
402
|
+
'typescript',
|
|
403
|
+
'@angular/cli',
|
|
404
|
+
'webpack',
|
|
405
|
+
'webpack-cli',
|
|
406
|
+
'ts-jest',
|
|
407
|
+
];
|
|
408
|
+
return dependencies
|
|
409
|
+
.map(discover)
|
|
410
|
+
.reduce<schema.Dependencies>((acc, dependency) => {
|
|
411
|
+
if (dependency) {
|
|
412
|
+
acc[dependency[0]] = dependency[1];
|
|
413
|
+
}
|
|
414
|
+
return acc;
|
|
415
|
+
}, {});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function normalizeReportFileName(fileName: string | undefined) {
|
|
420
|
+
if (fileName) {
|
|
421
|
+
return normalizeFileName(path.relative(process.cwd(), fileName));
|
|
422
|
+
}
|
|
423
|
+
// File name is not required for test files. By default we accumulate tests under the '' key
|
|
424
|
+
return '';
|
|
425
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { MutantResult } from '@stryker-mutator/api/core';
|
|
4
|
+
import { Logger } from '@stryker-mutator/api/logging';
|
|
5
|
+
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
6
|
+
import { Reporter } from '@stryker-mutator/api/report';
|
|
7
|
+
|
|
8
|
+
import { reporterUtil } from './reporter-util.js';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_OUTPUT_PATH = 'reports/mutation/mutant-test-timings.json';
|
|
11
|
+
|
|
12
|
+
interface MutantTimingEntry {
|
|
13
|
+
id: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
status: MutantResult['status'];
|
|
16
|
+
duration?: number;
|
|
17
|
+
testsCompleted?: number;
|
|
18
|
+
executedTests: NonNullable<MutantResult['executedTests']>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class MutationTimingsReporter implements Reporter {
|
|
22
|
+
public static readonly inject = tokens(commonTokens.logger);
|
|
23
|
+
|
|
24
|
+
private readonly entries: MutantTimingEntry[] = [];
|
|
25
|
+
private mainPromise: Promise<void> | undefined;
|
|
26
|
+
|
|
27
|
+
constructor(private readonly log: Logger) {}
|
|
28
|
+
|
|
29
|
+
public onMutantTested(result: MutantResult): void {
|
|
30
|
+
if (!result.executedTests?.length) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
this.entries.push({
|
|
34
|
+
id: result.id,
|
|
35
|
+
fileName: result.fileName,
|
|
36
|
+
status: result.status,
|
|
37
|
+
duration: result.duration,
|
|
38
|
+
testsCompleted: result.testsCompleted,
|
|
39
|
+
executedTests: result.executedTests,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public onMutationTestReportReady(): void {
|
|
44
|
+
if (
|
|
45
|
+
this.entries.length === 0 &&
|
|
46
|
+
process.env.STRYKER_MUTATION_TEST_TIMINGS !== '1'
|
|
47
|
+
) {
|
|
48
|
+
this.log.debug(
|
|
49
|
+
'Skipping mutation-timings report because no timing entries were captured.',
|
|
50
|
+
);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const outputPath = path.normalize(
|
|
54
|
+
process.env.STRYKER_MUTATION_TEST_TIMINGS_FILE ?? DEFAULT_OUTPUT_PATH,
|
|
55
|
+
);
|
|
56
|
+
this.log.debug(`Using relative path ${outputPath}`);
|
|
57
|
+
const payload = {
|
|
58
|
+
schemaVersion: '1',
|
|
59
|
+
generatedAt: new Date().toISOString(),
|
|
60
|
+
summary: {
|
|
61
|
+
mutantsWithTimings: this.entries.length,
|
|
62
|
+
executedTests: this.entries.reduce(
|
|
63
|
+
(sum, entry) => sum + entry.executedTests.length,
|
|
64
|
+
0,
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
mutants: this.entries,
|
|
68
|
+
};
|
|
69
|
+
this.mainPromise = reporterUtil.writeFile(
|
|
70
|
+
path.resolve(outputPath),
|
|
71
|
+
JSON.stringify(payload),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public wrapUp(): Promise<void> | undefined {
|
|
76
|
+
return this.mainPromise;
|
|
77
|
+
}
|
|
78
|
+
}
|