mootant 0.2.0 → 0.3.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/bin/mootant.js +3 -2
- package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -6
- package/dist/adapters/jest/collect-jest-dependencies.js +20 -14
- package/dist/adapters/jest/get-jest-cache-inputs.d.ts +14 -13
- package/dist/adapters/jest/index.d.ts +3 -1
- package/dist/adapters/jest/run-dry.js +20 -20
- package/dist/adapters/jest/start-jest-session.d.ts +6 -2
- package/dist/adapters/jest/start-jest-session.js +9 -2
- package/dist/adapters/jest/types/jest-handle.d.ts +2 -1
- package/dist/adapters/jest/types/jest-record.d.ts +4 -3
- package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
- package/dist/adapters/jest/worker/boot-worker.d.ts +5 -4
- package/dist/adapters/jest/worker/create-test-runner.d.ts +4 -1
- package/dist/adapters/jest/worker/keep-reset-loads.d.ts +13 -0
- package/dist/adapters/jest/worker/list-runtime-files.d.ts +13 -0
- package/dist/adapters/jest/worker/run-unit.d.ts +25 -20
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- package/dist/adapters/node-test/check-typescript.js +2 -2
- package/dist/adapters/node-test/collect-node-dependencies.d.ts +7 -5
- package/dist/adapters/node-test/collect-node-dependencies.js +26 -20
- package/dist/adapters/node-test/create-spare-processes.d.ts +26 -0
- package/dist/adapters/node-test/create-spare-processes.js +53 -0
- package/dist/adapters/node-test/filter-exec-argv.d.ts +2 -1
- package/dist/adapters/node-test/filter-exec-argv.js +13 -12
- package/dist/adapters/node-test/get-node-cache-inputs.js +1 -1
- package/dist/adapters/node-test/get-unit-deadline.d.ts +6 -5
- package/dist/adapters/node-test/index.d.ts +2 -2
- package/dist/adapters/node-test/index.js +1 -0
- package/dist/adapters/node-test/is-group-alive.d.ts +8 -0
- package/dist/adapters/node-test/is-group-alive.js +8 -0
- package/dist/adapters/node-test/list-setup-files.js +2 -2
- package/dist/adapters/node-test/place-preload.d.ts +2 -1
- package/dist/adapters/node-test/place-preload.js +24 -18
- package/dist/adapters/node-test/preload/create-commonjs-route.js +1 -1
- package/dist/adapters/node-test/preload/preload.js +54 -52
- package/dist/adapters/node-test/preload/read-line-sync.d.ts +11 -0
- package/dist/adapters/node-test/preload/read-line-sync.js +25 -0
- package/dist/adapters/node-test/preload/read-unit.d.ts +11 -5
- package/dist/adapters/node-test/preload/read-unit.js +5 -4
- package/dist/adapters/node-test/run-isolated.d.ts +19 -10
- package/dist/adapters/node-test/run-isolated.js +68 -52
- package/dist/adapters/node-test/run-test-file.d.ts +12 -4
- package/dist/adapters/node-test/run-test-file.js +18 -14
- package/dist/adapters/node-test/run-test-process.d.ts +30 -13
- package/dist/adapters/node-test/run-test-process.js +38 -40
- package/dist/adapters/node-test/start-node-test-session.d.ts +10 -2
- package/dist/adapters/node-test/start-node-test-session.js +90 -84
- package/dist/adapters/node-test/start-test-process.d.ts +30 -0
- package/dist/adapters/node-test/start-test-process.js +27 -0
- package/dist/adapters/node-test/types/node-test-handle.d.ts +14 -1
- package/dist/adapters/node-test/types/process-watch.d.ts +4 -3
- package/dist/adapters/node-test/types/spare-processes.d.ts +20 -0
- package/dist/adapters/node-test/types/test-process-outcome.d.ts +8 -1
- package/dist/adapters/shared/allows-spares.d.ts +11 -0
- package/dist/adapters/shared/allows-spares.js +23 -0
- package/dist/adapters/shared/create-environment-proxy.d.ts +4 -3
- package/dist/adapters/shared/create-input-filter.d.ts +17 -14
- package/dist/adapters/shared/create-input-filter.js +2 -2
- package/dist/adapters/shared/enable-compile-cache.d.ts +32 -0
- package/dist/adapters/shared/enable-compile-cache.js +7 -0
- package/dist/adapters/shared/find-tsconfig-property.d.ts +13 -0
- package/dist/adapters/shared/find-tsconfig-property.js +6 -0
- package/dist/adapters/shared/get-spare-limit.d.ts +10 -0
- package/dist/adapters/shared/get-spare-limit.js +5 -0
- package/dist/adapters/shared/index-environment-hashes.d.ts +2 -2
- package/dist/adapters/shared/index-environment-hashes.js +5 -13
- package/dist/adapters/{node-test → shared}/list-flag-values.d.ts +2 -1
- package/dist/adapters/shared/list-flag-values.js +10 -0
- package/dist/adapters/shared/list-tsconfig-files.d.ts +14 -5
- package/dist/adapters/shared/list-tsconfig-files.js +15 -13
- package/dist/adapters/shared/parse-tsconfig.d.ts +10 -0
- package/dist/adapters/shared/parse-tsconfig.js +19 -0
- package/dist/adapters/shared/read-flag-name.d.ts +9 -0
- package/dist/adapters/shared/read-flag-name.js +5 -0
- package/dist/adapters/shared/read-node-options.d.ts +11 -0
- package/dist/adapters/shared/read-node-options.js +6 -0
- package/dist/adapters/shared/read-prefork-switch.d.ts +10 -0
- package/dist/adapters/shared/read-prefork-switch.js +5 -0
- package/dist/adapters/shared/read-tsconfig-extends.d.ts +2 -5
- package/dist/adapters/shared/read-tsconfig-extends.js +16 -31
- package/dist/adapters/shared/read-tsconfig-references.d.ts +12 -0
- package/dist/adapters/shared/read-tsconfig-references.js +13 -0
- package/dist/adapters/shared/track-file-reads.d.ts +13 -12
- package/dist/adapters/shared/track-file-reads.js +71 -71
- package/dist/adapters/shared/track-process-group.d.ts +2 -1
- package/dist/adapters/shared/track-process-group.js +7 -2
- package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +11 -5
- package/dist/adapters/vitest/collect-dependencies.js +36 -27
- package/dist/adapters/vitest/configure-project.d.ts +3 -2
- package/dist/adapters/vitest/configure-project.js +1 -1
- package/dist/adapters/vitest/create-forks-pool.d.ts +34 -7
- package/dist/adapters/vitest/create-forks-pool.js +102 -24
- package/dist/adapters/vitest/create-interleaved-sequencer.d.ts +3 -2
- package/dist/adapters/vitest/drop-signal-listeners.d.ts +14 -0
- package/dist/adapters/vitest/drop-signal-listeners.js +15 -0
- package/dist/adapters/vitest/get-cache-inputs.d.ts +3 -1
- package/dist/adapters/vitest/get-cache-inputs.js +43 -28
- package/dist/adapters/vitest/get-module-file.d.ts +3 -5
- package/dist/adapters/vitest/get-module-file.js +1 -1
- package/dist/adapters/vitest/get-spare-key.d.ts +15 -0
- package/dist/adapters/vitest/get-spare-key.js +15 -0
- package/dist/adapters/vitest/index.d.ts +2 -1
- package/dist/adapters/vitest/index.js +1 -0
- package/dist/adapters/vitest/is-virtual-module.d.ts +1 -2
- package/dist/adapters/vitest/is-virtual-module.js +1 -1
- package/dist/adapters/vitest/list-script-defines.d.ts +13 -0
- package/dist/adapters/vitest/list-script-defines.js +22 -0
- package/dist/adapters/vitest/read-unit-inputs.d.ts +2 -1
- package/dist/adapters/vitest/run-dry.js +1 -1
- package/dist/adapters/vitest/run-plan.d.ts +10 -8
- package/dist/adapters/vitest/run-plan.js +1 -1
- package/dist/adapters/vitest/run-specifications.d.ts +9 -2
- package/dist/adapters/vitest/run-specifications.js +22 -12
- package/dist/adapters/vitest/runner.d.ts +60 -29
- package/dist/adapters/vitest/runner.js +109 -86
- package/dist/adapters/vitest/start-vitest-session.d.ts +5 -1
- package/dist/adapters/vitest/start-vitest-session.js +64 -59
- package/dist/adapters/vitest/stop-hung-worker.d.ts +11 -4
- package/dist/adapters/vitest/stop-hung-worker.js +20 -7
- package/dist/adapters/vitest/types/mootant-forks-pool.d.ts +47 -0
- package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
- package/dist/adapters/vitest/types/vitest-worker.d.ts +48 -33
- package/dist/adapters/vitest/wait-for-workers.d.ts +5 -2
- package/dist/adapters/vitest/wait-for-workers.js +15 -15
- package/dist/adapters/vitest/worker/track-meta-defines.d.ts +39 -0
- package/dist/adapters/vitest/worker/track-meta-defines.js +23 -0
- package/dist/adapters/vitest/worker/track-values.d.ts +38 -0
- package/dist/adapters/vitest/worker/track-values.js +45 -0
- package/dist/adapters/vitest/worker/value-prefixes.d.ts +12 -0
- package/dist/adapters/vitest/worker/value-prefixes.js +6 -0
- package/dist/adapters/vitest/worker/wait-for-turn.d.ts +8 -6
- package/dist/adapters/vitest/worker/watch-property.d.ts +17 -0
- package/dist/adapters/vitest/worker/watch-property.js +27 -0
- package/dist/cli/create-run-progress.d.ts +8 -1
- package/dist/cli/create-run-progress.js +4 -1
- package/dist/cli/ensure-exit.d.ts +11 -0
- package/dist/cli/ensure-exit.js +15 -0
- package/dist/cli/html/build-html-report.js +1 -0
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-overview.d.ts +3 -3
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +3 -2
- package/dist/cli/parse-arguments.d.ts +4 -0
- package/dist/cli/parse-arguments.js +4 -1
- package/dist/cli/report/build-run-report.js +1 -0
- package/dist/cli/report/format-command.d.ts +5 -0
- package/dist/cli/report/format-command.js +1 -1
- package/dist/cli/report/format-run-text-report.d.ts +5 -4
- package/dist/cli/report/format-run-text-report.js +10 -10
- package/dist/cli/report/slim-run-report.d.ts +10 -10
- package/dist/cli/report/slim-run-report.js +1 -0
- package/dist/cli/run-mutation.d.ts +5 -1
- package/dist/cli/run-mutation.js +32 -24
- package/dist/cli/terminal/create-spinner.d.ts +1 -2
- package/dist/cli/terminal/create-spinner.js +23 -32
- package/dist/cli/watch-interrupts.d.ts +41 -0
- package/dist/cli/watch-interrupts.js +32 -0
- package/dist/core/cache/apply-cached-units.d.ts +8 -7
- package/dist/core/cache/build-hash.d.ts +9 -0
- package/dist/core/cache/build-hash.js +2 -0
- package/dist/core/cache/cache-version.d.ts +4 -4
- package/dist/core/cache/check-dry-snapshot.d.ts +25 -0
- package/dist/core/cache/check-dry-snapshot.js +13 -0
- package/dist/core/cache/create-dry-reuse-miss.d.ts +12 -0
- package/dist/core/cache/create-dry-reuse-miss.js +7 -0
- package/dist/core/cache/create-dry-snapshot.d.ts +71 -0
- package/dist/core/cache/create-dry-snapshot.js +27 -0
- package/dist/core/cache/create-run-cache.d.ts +20 -2
- package/dist/core/cache/create-run-cache.js +31 -22
- package/dist/core/cache/create-snapshot-session.d.ts +12 -0
- package/dist/core/cache/create-snapshot-session.js +19 -0
- package/dist/core/cache/get-build-id.d.ts +11 -0
- package/dist/core/cache/get-build-id.js +7 -0
- package/dist/core/cache/get-cache-path.d.ts +1 -1
- package/dist/core/cache/get-cache-path.js +1 -1
- package/dist/core/cache/get-dry-snapshot-key.d.ts +47 -0
- package/dist/core/cache/get-dry-snapshot-key.js +43 -0
- package/dist/core/cache/get-dry-snapshot-path.d.ts +9 -0
- package/dist/core/cache/get-dry-snapshot-path.js +5 -0
- package/dist/core/cache/get-environment-key.d.ts +9 -4
- package/dist/core/cache/get-environment-key.js +3 -2
- package/dist/core/cache/get-test-file-keys.d.ts +2 -1
- package/dist/core/cache/get-test-file-keys.js +11 -10
- package/dist/core/cache/hash-files.d.ts +8 -7
- package/dist/core/cache/hash-files.js +17 -11
- package/dist/core/cache/hash-project-tree.d.ts +22 -0
- package/dist/core/cache/hash-project-tree.js +69 -0
- package/dist/core/cache/is-dry-reuse-miss.d.ts +8 -0
- package/dist/core/cache/is-dry-reuse-miss.js +4 -0
- package/dist/core/cache/list-file-hashes.d.ts +4 -0
- package/dist/core/cache/list-file-hashes.js +5 -2
- package/dist/core/cache/list-install-states.d.ts +12 -0
- package/dist/core/cache/list-install-states.js +19 -0
- package/dist/core/cache/list-variable-hashes.d.ts +15 -0
- package/dist/core/cache/list-variable-hashes.js +14 -0
- package/dist/core/cache/prepare-run-cache.d.ts +48 -22
- package/dist/core/cache/prepare-run-cache.js +86 -73
- package/dist/core/cache/read-dry-snapshot.d.ts +10 -0
- package/dist/core/cache/read-dry-snapshot.js +15 -0
- package/dist/core/cache/read-run-cache.js +6 -2
- package/dist/core/cache/save-dry-snapshot.d.ts +34 -0
- package/dist/core/cache/save-dry-snapshot.js +32 -0
- package/dist/core/cache/volatile-variables.d.ts +7 -0
- package/dist/core/cache/volatile-variables.js +11 -0
- package/dist/core/cache/write-run-cache.js +1 -1
- package/dist/core/config/load-typescript-config.d.ts +6 -1
- package/dist/core/config/load-typescript-config.js +26 -10
- package/dist/core/config/prepare-run.d.ts +7 -3
- package/dist/core/config/prepare-run.js +1 -0
- package/dist/core/config/resolve-run-settings.d.ts +3 -2
- package/dist/core/config/resolve-run-settings.js +1 -0
- package/dist/core/config/validate-config.js +3 -2
- package/dist/core/files/get-package-manifest.d.ts +12 -0
- package/dist/core/files/get-package-manifest.js +7 -0
- package/dist/core/generate/collect-candidates.d.ts +5 -1
- package/dist/core/generate/collect-candidates.js +125 -97
- package/dist/core/generate/generate-file-mutants.js +6 -5
- package/dist/core/index.d.ts +18 -0
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
- package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-group-constant.d.ts +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +3 -3
- package/dist/core/mutators/shared/get-loop-running-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-nullish-swap-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-or-default-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-owned-constants.d.ts +2 -2
- package/dist/core/mutators/shared/leave-now-skip.d.ts +2 -2
- package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
- package/dist/core/plugins/create-mutator-registry.d.ts +4 -2
- package/dist/core/plugins/create-mutator-registry.js +15 -5
- package/dist/core/plugins/validate-plugin.d.ts +3 -3
- package/dist/core/plugins/validate-plugin.js +32 -10
- package/dist/core/regex/collect-pattern-changes.d.ts +2 -2
- package/dist/core/regex/create-regex-replacement.d.ts +2 -2
- package/dist/core/run/apply-isolated-result.d.ts +22 -14
- package/dist/core/run/apply-isolated-result.js +45 -26
- package/dist/core/run/count-run.d.ts +2 -1
- package/dist/core/run/create-run-state.d.ts +5 -0
- package/dist/core/run/create-run-state.js +1 -0
- package/dist/core/run/create-work-directory.d.ts +4 -1
- package/dist/core/run/create-work-directory.js +15 -12
- package/dist/core/run/decide-evidence.d.ts +4 -3
- package/dist/core/run/get-unit-evidence.d.ts +13 -7
- package/dist/core/run/get-unit-evidence.js +1 -1
- package/dist/core/run/guard-session.d.ts +18 -0
- package/dist/core/run/guard-session.js +30 -0
- package/dist/core/run/live-work-directories.d.ts +5 -0
- package/dist/core/run/live-work-directories.js +2 -0
- package/dist/core/run/read-isolated-unit.d.ts +6 -3
- package/dist/core/run/read-isolated-unit.js +77 -38
- package/dist/core/run/remove-live-work-directories.d.ts +7 -0
- package/dist/core/run/remove-live-work-directories.js +12 -0
- package/dist/core/run/run-isolated-rounds.d.ts +16 -12
- package/dist/core/run/run-isolated-rounds.js +3 -2
- package/dist/core/run/validate-adapter.d.ts +1 -1
- package/dist/core/run/validate-adapter.js +1 -1
- package/dist/core/run-mutants.d.ts +34 -2
- package/dist/core/run-mutants.js +356 -216
- package/dist/core/skips/skip-rules.d.ts +3 -1
- package/dist/package.js +1 -1
- package/dist/types/adapter/adapter-context.d.ts +20 -0
- package/dist/types/adapter/adapter-session.d.ts +2 -1
- package/dist/types/adapter/cache-inputs.d.ts +3 -2
- package/dist/types/adapter/dry-file.d.ts +4 -2
- package/dist/types/adapter/isolated-plan.d.ts +2 -1
- package/dist/types/adapter/isolated-result.d.ts +3 -1
- package/dist/types/adapter/run-inputs.d.ts +5 -4
- package/dist/types/adapter/test-adapter.d.ts +7 -0
- package/dist/types/cache/cache-entry.d.ts +9 -7
- package/dist/types/cache/cached-inputs.d.ts +2 -2
- package/dist/types/cache/dry-snapshot.d.ts +76 -0
- package/dist/types/cache/project-tree.d.ts +16 -0
- package/dist/types/cache/run-cache-file.d.ts +1 -1
- package/dist/types/cache/run-cache.d.ts +6 -5
- package/dist/types/config/plugin.d.ts +11 -2
- package/dist/types/config/run-config.d.ts +10 -0
- package/dist/types/config/run-settings.d.ts +6 -0
- package/dist/types/mutant/core-note.d.ts +12 -0
- package/dist/types/mutant/diagnostic.d.ts +1 -0
- package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
- package/dist/types/mutant/skip-note.d.ts +7 -6
- package/dist/types/mutant/skip-rule-id.d.ts +3 -2
- package/dist/types/mutant/skip-rule.d.ts +2 -1
- package/dist/types/mutant/skipped-candidate.d.ts +14 -7
- package/dist/types/mutant/skipped-mutant.d.ts +6 -6
- package/dist/types/mutator/mutator.d.ts +3 -2
- package/dist/types/mutator/registered-mutator.d.ts +8 -0
- package/dist/types/regex/regex-change.d.ts +2 -2
- package/dist/types/report/html-report.d.ts +3 -2
- package/dist/types/report/list-report-skipped.d.ts +3 -2
- package/dist/types/report/run-report.d.ts +11 -2
- package/dist/types/report/slim-run-report.d.ts +1 -1
- package/dist/types/run/isolated-evidence.d.ts +3 -2
- package/dist/types/run/isolated-reason.d.ts +2 -1
- package/dist/types/run/run-durations.d.ts +8 -3
- package/dist/types/run/run-event.d.ts +10 -7
- package/dist/types/run/run-result.d.ts +11 -2
- package/dist/types/run/run-state.d.ts +21 -0
- package/dist/types/run/try-cause.d.ts +2 -1
- package/package.json +1 -1
- package/readme.md +85 -68
- package/skills/mootant/SKILL.md +36 -19
- package/skills/mootant/references/mutators.md +29 -23
- package/dist/adapters/node-test/list-flag-values.js +0 -9
- /package/dist/adapters/{node-test → shared}/loader-flags.d.ts +0 -0
- /package/dist/adapters/{node-test → shared}/loader-flags.js +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.js +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
2
|
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
3
3
|
import { DryRunResult } from '../../types/adapter/dry-run-result.js';
|
|
4
|
+
import { CacheInputs } from '../../types/adapter/cache-inputs.js';
|
|
4
5
|
import { TestAdapter } from '../../types/adapter/test-adapter.js';
|
|
5
6
|
import { FileMutants } from '../../types/mutant/file-mutants.js';
|
|
6
7
|
import { StoredCache } from '../../types/cache/stored-cache.js';
|
|
@@ -30,10 +31,23 @@ interface PrepareInput {
|
|
|
30
31
|
* Entries and inputs of the cache file, read while the dry run went on.
|
|
31
32
|
*/
|
|
32
33
|
stored: Promise<StoredCache>;
|
|
34
|
+
/**
|
|
35
|
+
* Absolute paths of the files the dry run switched, those it dropped as
|
|
36
|
+
* broken left out: the hit counts of a unit cover only their sites, so a
|
|
37
|
+
* timeout by the hit limit holds only for runs that switch the same files.
|
|
38
|
+
*/
|
|
39
|
+
switched: readonly string[];
|
|
33
40
|
/**
|
|
34
41
|
* Live test runner after the dry run.
|
|
35
42
|
*/
|
|
36
43
|
session: AdapterSession;
|
|
44
|
+
/**
|
|
45
|
+
* Whether isolated units of one test file run at the same time; such runs
|
|
46
|
+
* never reuse the verdicts of other runs, nor other runs theirs, since tests
|
|
47
|
+
* that rely on a test file never running twice at once may give other
|
|
48
|
+
* verdicts. False when omitted.
|
|
49
|
+
*/
|
|
50
|
+
parallelUnits?: boolean;
|
|
37
51
|
/**
|
|
38
52
|
* Coverage and tests of the dry run.
|
|
39
53
|
*/
|
|
@@ -59,6 +73,11 @@ interface PrepareInput {
|
|
|
59
73
|
* listed.
|
|
60
74
|
*/
|
|
61
75
|
started: number;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the run is in fast mode, which neither stores nor reuses timeouts
|
|
78
|
+
* by the hit limit (`RunCacheInput.timeouts`).
|
|
79
|
+
*/
|
|
80
|
+
fast: boolean;
|
|
62
81
|
/**
|
|
63
82
|
* Project root.
|
|
64
83
|
*/
|
|
@@ -77,6 +96,11 @@ interface PreparedCache {
|
|
|
77
96
|
* has unknown content, or null.
|
|
78
97
|
*/
|
|
79
98
|
warning: Diagnostic | null;
|
|
99
|
+
/**
|
|
100
|
+
* What the session said every verdict depends on (`cacheInputs`), asked once,
|
|
101
|
+
* or null when the adapter cannot tell.
|
|
102
|
+
*/
|
|
103
|
+
inputs: CacheInputs | null;
|
|
80
104
|
/**
|
|
81
105
|
* Cache of the run, or null.
|
|
82
106
|
*/
|
|
@@ -85,30 +109,32 @@ interface PreparedCache {
|
|
|
85
109
|
/**
|
|
86
110
|
* Prepares the cache of a run after its dry run: asks the adapter what every
|
|
87
111
|
* verdict depends on, hashes those files together with the `.env` files, the
|
|
88
|
-
* lockfile
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* file
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* or the user
|
|
112
|
+
* lockfile with the files that tell what was installed (`listInstallStates`),
|
|
113
|
+
* `package.json` and the `tsconfig` and `jsconfig` files of the root, every
|
|
114
|
+
* file a test file depended on and every file stored entries read beyond that,
|
|
115
|
+
* each file once, then builds the environment key and the key of every test
|
|
116
|
+
* file, which takes in the environment variables it read, and the key of every
|
|
117
|
+
* test file over what it reads outside the files mutants are listed from, for
|
|
118
|
+
* the incremental keys. Files modified since the run started may have changed
|
|
119
|
+
* after the test runner read them, so their hash may not be what verdicts came
|
|
120
|
+
* from: a test file that depends on one gets no key, and no test file gets one
|
|
121
|
+
* when a file of the environment changed. The same goes for a path whose
|
|
122
|
+
* content is unknown, such as a device or a pipe (`UNKNOWN_HASH`), whatever its
|
|
123
|
+
* time. Files the test code of the dry run changed itself (`DryFile.modified`),
|
|
124
|
+
* files of the environment among them, are hashed as they are now, which is
|
|
125
|
+
* what the next run starts from; `saveRunCache` checks that their contents
|
|
126
|
+
* stayed so. A test runner that read such a file before the test code wrote it,
|
|
127
|
+
* as Vitest loads the `.env` files of its mode when it starts, may have run
|
|
128
|
+
* with an earlier text than the keys show, whether the test code or the user
|
|
129
|
+
* changed it. A run with parallel units has an environment key of its own.
|
|
130
|
+
* Outside fast mode, the cache keeps timeouts by the hit limit too.
|
|
105
131
|
*
|
|
106
132
|
* @param input - Session, dry run, settings and the stored entries.
|
|
107
|
-
* @returns Cache of the run
|
|
108
|
-
* verdicts depend on or no test file
|
|
109
|
-
* environment, or a dependency while no test
|
|
110
|
-
* the run or has unknown content, with a
|
|
111
|
-
* the first such file.
|
|
133
|
+
* @returns Cache of the run, with what the session said verdicts depend on. No
|
|
134
|
+
* cache when the adapter cannot tell what verdicts depend on or no test file
|
|
135
|
+
* has a key; when a file of the environment, or a dependency while no test
|
|
136
|
+
* file has a key, changed during the run or has unknown content, with a
|
|
137
|
+
* `cache-skipped` warning that names the first such file.
|
|
112
138
|
*/
|
|
113
139
|
export declare function prepareRunCache(input: PrepareInput): Promise<PreparedCache>;
|
|
114
140
|
export {};
|
|
@@ -1,105 +1,118 @@
|
|
|
1
1
|
import { getTestFileKey as e } from "../run/get-test-file-key.js";
|
|
2
2
|
import { getEnvironmentKey as t } from "./get-environment-key.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { listInstallStates as n } from "./list-install-states.js";
|
|
4
|
+
import { compareCodeUnits as r } from "../compare-code-units.js";
|
|
5
|
+
import { getDisplayPath as i } from "../run/get-display-path.js";
|
|
6
|
+
import { findChangedFiles as a } from "./find-changed-files.js";
|
|
7
|
+
import { getTestFileKeys as o } from "./get-test-file-keys.js";
|
|
8
|
+
import { getPortablePath as s } from "./get-portable-path.js";
|
|
9
|
+
import { createRunCache as c } from "./create-run-cache.js";
|
|
10
|
+
import { findLockfile as l } from "./find-lockfile.js";
|
|
11
|
+
import { createDigest as u } from "./create-digest.js";
|
|
8
12
|
import "./unknown-hash.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { getBuildId as d } from "./get-build-id.js";
|
|
14
|
+
import { hashFiles as f } from "./hash-files.js";
|
|
15
|
+
import p from "node:path";
|
|
16
|
+
import { createHash as m } from "node:crypto";
|
|
17
|
+
import { readdir as h } from "node:fs/promises";
|
|
18
|
+
async function g(g) {
|
|
19
|
+
let { session: _, setup: v, root: y, dry: b } = g;
|
|
20
|
+
if (_.cacheInputs === void 0) return {
|
|
16
21
|
warning: null,
|
|
22
|
+
inputs: null,
|
|
17
23
|
cache: null
|
|
18
24
|
};
|
|
19
|
-
let
|
|
20
|
-
...
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
let x = await _.cacheInputs(), S = l(y), C = [
|
|
26
|
+
...x.files,
|
|
27
|
+
...S === null ? [] : [S],
|
|
28
|
+
...n(y),
|
|
29
|
+
p.join(y, "package.json"),
|
|
30
|
+
...(await h(y)).filter((e) => /^(?:\.env|(?:jsconfig|tsconfig).*\.json$)/u.test(e)).map((e) => p.join(y, e))
|
|
31
|
+
], w = new Map(b.files.flatMap((t) => Array.isArray(t.dependencies) ? [[e(t), [t.file, ...t.dependencies]]] : [])), T = [...C, ...[...w.values()].flat()], E = new Set(b.files.flatMap((e) => e.modified ?? [])), D = await a(T, g.started);
|
|
32
|
+
for (let e of E) D.delete(e);
|
|
33
|
+
let O = await g.stored, k = await f([...T, ...[...O.inputs.values()].flatMap((e) => e.files.map(([e]) => p.resolve(y, e)))]);
|
|
34
|
+
function A(e) {
|
|
35
|
+
return D.has(e) || k.get(e) === "unknown";
|
|
29
36
|
}
|
|
30
|
-
function
|
|
31
|
-
let t =
|
|
37
|
+
function j(e) {
|
|
38
|
+
let t = i(e, y), n = t === "" ? "the root of the project" : t;
|
|
32
39
|
return {
|
|
33
40
|
warning: {
|
|
34
|
-
message:
|
|
41
|
+
message: k.get(e) === "unknown" ? `Verdicts were neither reused nor cached because ${n} is a device, a pipe or a socket, so mootant cannot tell whether it changed.` : `Verdicts were neither reused nor cached because ${n} has a modification time at or after the start of the run, so it may have changed while the run went on.`,
|
|
35
42
|
code: "cache-skipped",
|
|
36
43
|
severity: "warning",
|
|
37
44
|
column: null,
|
|
38
45
|
file: null,
|
|
39
46
|
line: null
|
|
40
47
|
},
|
|
41
|
-
cache: null
|
|
48
|
+
cache: null,
|
|
49
|
+
inputs: x
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
|
-
let
|
|
45
|
-
if (
|
|
46
|
-
let
|
|
52
|
+
let M = C.find((e) => A(e));
|
|
53
|
+
if (M !== void 0) return j(M);
|
|
54
|
+
let N = x.environment ?? {}, P = t({
|
|
47
55
|
mutators: {
|
|
48
|
-
mutators:
|
|
49
|
-
settings:
|
|
50
|
-
preset:
|
|
56
|
+
mutators: v.mutators.map((e) => [e.id, e.options]),
|
|
57
|
+
settings: v.settings,
|
|
58
|
+
preset: v.preset
|
|
51
59
|
},
|
|
52
60
|
runner: {
|
|
53
|
-
version:
|
|
54
|
-
runner:
|
|
55
|
-
adapter:
|
|
61
|
+
version: g.adapter.version ?? null,
|
|
62
|
+
runner: _.version ?? null,
|
|
63
|
+
adapter: g.adapter.name
|
|
56
64
|
},
|
|
57
|
-
|
|
58
|
-
settings:
|
|
59
|
-
limits:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
parallelUnits: g.parallelUnits === !0,
|
|
66
|
+
settings: x.settings,
|
|
67
|
+
limits: g.limits,
|
|
68
|
+
build: d(),
|
|
69
|
+
hashes: k,
|
|
70
|
+
files: C,
|
|
71
|
+
root: y
|
|
72
|
+
}), F = b.files.filter((t) => (w.get(e(t)) ?? []).every((e) => !A(e))), I = o({
|
|
64
73
|
mutated: /* @__PURE__ */ new Set(),
|
|
65
|
-
files:
|
|
66
|
-
environment:
|
|
67
|
-
variables:
|
|
68
|
-
hashes:
|
|
69
|
-
root:
|
|
74
|
+
files: F,
|
|
75
|
+
environment: P,
|
|
76
|
+
variables: N,
|
|
77
|
+
hashes: k,
|
|
78
|
+
root: y
|
|
70
79
|
});
|
|
71
|
-
if (
|
|
72
|
-
let e = [...
|
|
80
|
+
if (I.size === 0) {
|
|
81
|
+
let e = [...w.values()].flat().find((e) => A(e));
|
|
73
82
|
return e === void 0 ? {
|
|
74
83
|
warning: null,
|
|
75
|
-
cache: null
|
|
76
|
-
|
|
84
|
+
cache: null,
|
|
85
|
+
inputs: x
|
|
86
|
+
} : j(e);
|
|
77
87
|
}
|
|
78
88
|
return {
|
|
79
89
|
warning: null,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
inputs: x,
|
|
91
|
+
cache: c({
|
|
92
|
+
sources: new Map(g.files.flatMap((e) => e.source === null ? [] : [[e.file, m("sha256").update(e.source).digest("hex")]])),
|
|
93
|
+
outsideKeys: o({
|
|
94
|
+
mutated: new Set(g.files.map((e) => e.absolute)),
|
|
95
|
+
files: F,
|
|
96
|
+
environment: P,
|
|
97
|
+
variables: N,
|
|
98
|
+
hashes: k,
|
|
99
|
+
root: y
|
|
89
100
|
}),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
switched: u(g.switched.map((e) => s(e, y)).toSorted(r)),
|
|
102
|
+
reads: new Map(b.files.map((t) => [e(t), t.environment ?? []])),
|
|
103
|
+
dependencies: new Map([...w].filter(([e]) => I.has(e))),
|
|
104
|
+
regions: new Map(g.files.flatMap((e) => [...e.regions ?? []])),
|
|
105
|
+
incremental: g.incremental,
|
|
106
|
+
analysis: g.analysis,
|
|
107
|
+
timeouts: !g.fast,
|
|
108
|
+
environment: C,
|
|
109
|
+
now: g.now,
|
|
110
|
+
variables: N,
|
|
111
|
+
fileKeys: I,
|
|
112
|
+
stored: O,
|
|
113
|
+
hashes: k,
|
|
114
|
+
root: y
|
|
102
115
|
})
|
|
103
116
|
};
|
|
104
117
|
}
|
|
105
|
-
export {
|
|
118
|
+
export { g as prepareRunCache };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the saved dry run of a project (`DrySnapshot`). A missing or unreadable
|
|
4
|
+
* file, invalid JSON, another version or a value without the parts of a saved
|
|
5
|
+
* dry run gives none: it only ever makes a run faster.
|
|
6
|
+
*
|
|
7
|
+
* @param file - Absolute path of the file (`getDrySnapshotPath`).
|
|
8
|
+
* @returns The saved dry run, or null.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readDrySnapshot(file: string): Promise<DrySnapshot | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isRecord as e } from "../plugins/is-record.js";
|
|
2
|
+
import { readFile as t } from "node:fs/promises";
|
|
3
|
+
async function n(e) {
|
|
4
|
+
let n;
|
|
5
|
+
try {
|
|
6
|
+
n = JSON.parse(await t(e, "utf8"));
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return r(n) ? n : null;
|
|
11
|
+
}
|
|
12
|
+
function r(t) {
|
|
13
|
+
return e(t) && t.version === 8 && typeof t.key == "string" && typeof t.tree == "string" && Array.isArray(t.files) && Array.isArray(t.variables) && Array.isArray(t.testFiles) && e(t.session) && e(t.phase) && e(t.phase.dry);
|
|
14
|
+
}
|
|
15
|
+
export { n as readDrySnapshot };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isRecord as e } from "../plugins/is-record.js";
|
|
2
2
|
import { readFile as t } from "node:fs/promises";
|
|
3
|
-
const n = /* @__PURE__ */ new Set([
|
|
3
|
+
const n = /* @__PURE__ */ new Set([
|
|
4
|
+
"Survived",
|
|
5
|
+
"Timeout",
|
|
6
|
+
"Killed"
|
|
7
|
+
]), r = /* @__PURE__ */ new Set(["isolated", "batch"]);
|
|
4
8
|
async function i(n) {
|
|
5
9
|
let r = {
|
|
6
10
|
entries: /* @__PURE__ */ new Map(),
|
|
@@ -11,7 +15,7 @@ async function i(n) {
|
|
|
11
15
|
} catch {
|
|
12
16
|
return r;
|
|
13
17
|
}
|
|
14
|
-
if (!e(i) || i.version !==
|
|
18
|
+
if (!e(i) || i.version !== 8 || !e(i.entries) || !e(i.inputs)) return r;
|
|
15
19
|
let o = Object.entries(i.inputs);
|
|
16
20
|
for (let [e, t] of o) s(t) && r.inputs.set(e, t);
|
|
17
21
|
let c = Object.entries(i.entries);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
2
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Saves the dry run of a run for later runs (`DrySnapshot`), or removes the
|
|
5
|
+
* saved one when the run cannot be replayed. Before saving, the files of the
|
|
6
|
+
* saved dry run and everything under the project root are hashed again: when
|
|
7
|
+
* any of them changed during the run, such as a test file added while mutants
|
|
8
|
+
* ran, which the dry run never saw, nothing is saved and the saved one is
|
|
9
|
+
* removed too, and the first path that changed is named, against the tree the
|
|
10
|
+
* run hashed before the test runner started. A tree that can no longer be read
|
|
11
|
+
* is not saved either, with nothing to name. The file is written to a temporary
|
|
12
|
+
* file and renamed, so a reader never sees half of it. Failures are ignored, as
|
|
13
|
+
* a saved dry run only ever makes a run faster.
|
|
14
|
+
*
|
|
15
|
+
* @param input - What to save, and where.
|
|
16
|
+
* @param input.snapshot - Saved dry run of the run (`createDrySnapshot`), or
|
|
17
|
+
* null when the run cannot be replayed.
|
|
18
|
+
* @param input.tree - Project tree the run hashed before the test runner
|
|
19
|
+
* started, or null when it could not be read.
|
|
20
|
+
* @param input.outputs - Absolute paths mootant writes into the project during
|
|
21
|
+
* or after a run, such as the HTML report and the work directory, which are
|
|
22
|
+
* left out.
|
|
23
|
+
* @param input.file - Absolute path of the file (`getDrySnapshotPath`).
|
|
24
|
+
* @param input.root - Project root.
|
|
25
|
+
* @returns Null, or the end of a sentence that names a path that changed during
|
|
26
|
+
* the run, such as `logs was added during the run`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function saveDrySnapshot(input: {
|
|
29
|
+
snapshot: DrySnapshot | null;
|
|
30
|
+
outputs: readonly string[];
|
|
31
|
+
tree: ProjectTree | null;
|
|
32
|
+
file: string;
|
|
33
|
+
root: string;
|
|
34
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getDisplayPath as e } from "../run/get-display-path.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
import { hashProjectTree as n } from "./hash-project-tree.js";
|
|
4
|
+
import { hashFiles as r } from "./hash-files.js";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
import { mkdir as a, rename as o, rm as s, writeFile as c } from "node:fs/promises";
|
|
7
|
+
async function l(t) {
|
|
8
|
+
let { snapshot: i, tree: a, file: o, root: s } = t;
|
|
9
|
+
if (i === null || a === null) return await f(o), null;
|
|
10
|
+
let c = await r(i.files.map(([e]) => e)), l = i.files.find(([e, t]) => c.get(e) !== t);
|
|
11
|
+
if (l !== void 0) return await f(o), `${e(l[0], s)} changed during the run`;
|
|
12
|
+
let p = await n(s, t.outputs);
|
|
13
|
+
return p?.hash === a.hash ? (await d(i, o), null) : (await f(o), p === null ? null : u(a, p));
|
|
14
|
+
}
|
|
15
|
+
function u(e, n) {
|
|
16
|
+
let r = [.../* @__PURE__ */ new Set([...e.entries.keys(), ...n.entries.keys()])].toSorted(t).find((t) => e.entries.get(t) !== n.entries.get(t));
|
|
17
|
+
return e.entries.has(r) ? n.entries.has(r) ? `${r} changed during the run` : `${r} was removed during the run` : `${r} was added during the run`;
|
|
18
|
+
}
|
|
19
|
+
async function d(e, t) {
|
|
20
|
+
let n = `${t}.${process.pid}.tmp`;
|
|
21
|
+
try {
|
|
22
|
+
await a(i.dirname(t), { recursive: !0 }), await c(n, JSON.stringify(e)), await o(n, t);
|
|
23
|
+
} catch {
|
|
24
|
+
await f(n), await f(t);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function f(e) {
|
|
28
|
+
try {
|
|
29
|
+
await s(e, { force: !0 });
|
|
30
|
+
} catch {}
|
|
31
|
+
}
|
|
32
|
+
export { l as saveDrySnapshot };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variables that change from one shell or terminal to another
|
|
3
|
+
* without changing what tests do, and mootant's switch of spare test processes
|
|
4
|
+
* (`readPreforkSwitch`), which tests never see; left out of the hash of all
|
|
5
|
+
* variables, which stands for code that lists them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VOLATILE_VARIABLES: ReadonlySet<string>;
|
|
@@ -9,7 +9,7 @@ async function s(s, c, l) {
|
|
|
9
9
|
let d = e(u.entries, l), f = new Set([...d.values()].map((e) => e.inputs)), p = {
|
|
10
10
|
inputs: Object.fromEntries([...u.inputs].filter(([e]) => f.has(e))),
|
|
11
11
|
entries: Object.fromEntries(d),
|
|
12
|
-
version:
|
|
12
|
+
version: 8
|
|
13
13
|
}, m = `${s}.${process.pid}.tmp`;
|
|
14
14
|
try {
|
|
15
15
|
await r(n.dirname(s), { recursive: !0 }), await o(m, JSON.stringify(p)), await i(m, s);
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Loads a TypeScript configuration file and returns its default export: the
|
|
3
3
|
* `export default` of an ES module, or the `module.exports` of a CommonJS
|
|
4
4
|
* module. Node.js imports it directly when it can strip types (22.18 and
|
|
5
|
-
* later); older versions need the optional `jiti` package
|
|
5
|
+
* later); older versions need the optional `jiti` package, where version 1,
|
|
6
|
+
* without `createJiti`, counts as missing. A `.ts` file of a package whose
|
|
7
|
+
* `type` is not `module` loads with `jiti` too when it is installed: Node.js
|
|
8
|
+
* reads it as CommonJS, where `import` and `export` fail or, without a `type`
|
|
9
|
+
* field, draw a warning. A link counts as the file it points to, as in
|
|
10
|
+
* Node.js.
|
|
6
11
|
*
|
|
7
12
|
* @param file - Absolute path of the configuration file.
|
|
8
13
|
* @returns The default export of the file, or undefined when it has none.
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { listPackageFiles as e } from "../files/list-package-files.js";
|
|
2
|
+
import { readPackageType as t } from "../files/read-package-type.js";
|
|
3
|
+
import { importConfig as n } from "./import-config.js";
|
|
4
|
+
import { realpathSync as r } from "node:fs";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
async function a(a) {
|
|
7
|
+
let s = !!process.features.typescript;
|
|
8
|
+
if (s && !a.endsWith(".ts")) return n(a);
|
|
9
|
+
let c = r(a), l = s ? t(e(i.dirname(c), /* @__PURE__ */ new Map()).at(-1), /* @__PURE__ */ new Map()) : null;
|
|
10
|
+
if (l === "module") return n(a);
|
|
11
|
+
let u = {};
|
|
5
12
|
try {
|
|
6
|
-
|
|
7
|
-
} catch {
|
|
8
|
-
|
|
13
|
+
u = await import("jiti");
|
|
14
|
+
} catch {}
|
|
15
|
+
if (u.createJiti) {
|
|
16
|
+
let e = await u.createJiti(import.meta.url, { interopDefault: !1 }).import(c);
|
|
17
|
+
return e.__esModule === !0 ? e.default : e;
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
return
|
|
19
|
+
if (!s) throw Error("TypeScript configuration files need Node.js 22.18 or later, or the jiti package.");
|
|
20
|
+
return l === "commonjs" ? o(a) : n(a);
|
|
12
21
|
}
|
|
13
|
-
|
|
22
|
+
async function o(e) {
|
|
23
|
+
try {
|
|
24
|
+
return await n(e);
|
|
25
|
+
} catch (t) {
|
|
26
|
+
throw t instanceof SyntaxError && !("code" in t) ? Error(`${t.message}. Node.js reads the file as CommonJS because its package.json has "type": "commonjs"; to use import and export, install jiti or rename it to ${i.basename(e, ".ts")}.mts.`, { cause: t }) : t;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { a as loadTypescriptConfig };
|
|
@@ -2,7 +2,7 @@ import { PresetSettings } from '../../types/config/preset-settings.js';
|
|
|
2
2
|
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
3
3
|
import { RunConfig } from '../../types/config/run-config.js';
|
|
4
4
|
/**
|
|
5
|
-
* Mutators, settings, root and run settings of a run.
|
|
5
|
+
* Mutators, settings, root, configuration file and run settings of a run.
|
|
6
6
|
*/
|
|
7
7
|
interface RunSetup {
|
|
8
8
|
/**
|
|
@@ -17,6 +17,10 @@ interface RunSetup {
|
|
|
17
17
|
* Mutators turned on, in rank order.
|
|
18
18
|
*/
|
|
19
19
|
mutators: ActiveMutator[];
|
|
20
|
+
/**
|
|
21
|
+
* Absolute path of the configuration file, or null without one.
|
|
22
|
+
*/
|
|
23
|
+
file: string | null;
|
|
20
24
|
/**
|
|
21
25
|
* Presets the run extends, joined for reports.
|
|
22
26
|
*/
|
|
@@ -58,8 +62,8 @@ interface RunOptions {
|
|
|
58
62
|
* win.
|
|
59
63
|
*
|
|
60
64
|
* @param options - Configuration path, preset and working directory.
|
|
61
|
-
* @returns Active mutators, settings, known ids, presets, root
|
|
62
|
-
* of the run.
|
|
65
|
+
* @returns Active mutators, settings, known ids, presets, root, configuration
|
|
66
|
+
* file and run settings of the run.
|
|
63
67
|
* @throws Error - When the configuration or a plugin cannot be loaded or is
|
|
64
68
|
* invalid, or a preset or mutator id is unknown.
|
|
65
69
|
*/
|
|
@@ -5,11 +5,12 @@ import { RunConfig } from '../../types/config/run-config.js';
|
|
|
5
5
|
* configuration, which wins over the default. The defaults are those
|
|
6
6
|
* `RunConfig` documents: the runner's own concurrency, no threshold, a timeout
|
|
7
7
|
* factor of 3 with a constant of 250, a hit limit factor of 100 with a floor of
|
|
8
|
-
* 100000, the cache on, and incremental
|
|
8
|
+
* 100000, the cache on, and incremental mode, fast mode and parallel units
|
|
9
|
+
* off.
|
|
9
10
|
*
|
|
10
11
|
* @param options - Settings given on the command line, undefined when not
|
|
11
12
|
* given.
|
|
12
13
|
* @param run - Run settings of the configuration, or an empty object.
|
|
13
14
|
* @returns Settings of the run with the defaults filled in.
|
|
14
15
|
*/
|
|
15
|
-
export declare function resolveRunSettings(options: Pick<RunConfig, 'concurrency' | 'incremental' | 'threshold' | 'cache' | 'fast'>, run: RunConfig): RunSettings;
|
|
16
|
+
export declare function resolveRunSettings(options: Pick<RunConfig, 'parallelUnits' | 'concurrency' | 'incremental' | 'threshold' | 'cache' | 'fast'>, run: RunConfig): RunSettings;
|
|
@@ -10,6 +10,7 @@ function e(e, t) {
|
|
|
10
10
|
factor: t.timeout?.factor ?? 3
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
parallelUnits: e.parallelUnits ?? t.parallelUnits ?? !1,
|
|
13
14
|
incremental: e.incremental ?? t.incremental ?? !1,
|
|
14
15
|
concurrency: e.concurrency ?? t.concurrency ?? null,
|
|
15
16
|
threshold: e.threshold ?? t.threshold ?? null,
|
|
@@ -15,6 +15,7 @@ let i = [
|
|
|
15
15
|
"hitLimit",
|
|
16
16
|
"html",
|
|
17
17
|
"incremental",
|
|
18
|
+
"parallelUnits",
|
|
18
19
|
"paths",
|
|
19
20
|
"runner",
|
|
20
21
|
"threshold",
|
|
@@ -31,8 +32,8 @@ function s(e) {
|
|
|
31
32
|
let e = n(t, a);
|
|
32
33
|
return `"${t}" is not a run setting${e === null ? "" : ` (did you mean "${e}"?)`}`;
|
|
33
34
|
}
|
|
34
|
-
let {
|
|
35
|
-
return
|
|
35
|
+
let { parallelUnits: t, incremental: i, concurrency: o, threshold: s, runner: c, paths: u, cache: d, fast: f, html: p } = e;
|
|
36
|
+
return s !== void 0 && (typeof s != "number" || !(s >= 0) || !(s <= 100)) ? "\"threshold\" must be a number from 0 to 100" : o !== void 0 && (!Number.isSafeInteger(o) || o < 1) ? "\"concurrency\" must be a positive integer" : f !== void 0 && typeof f != "boolean" ? "\"fast\" must be true or false" : d !== void 0 && typeof d != "boolean" ? "\"cache\" must be true or false" : i !== void 0 && typeof i != "boolean" ? "\"incremental\" must be true or false" : t !== void 0 && typeof t != "boolean" ? "\"parallelUnits\" must be true or false" : p !== void 0 && typeof p != "boolean" && (typeof p != "string" || p === "") ? "\"html\" must be true, false or a path" : c !== void 0 && !r(c) && (typeof c != "string" || c === "") ? "\"runner\" must be a built-in adapter name or an adapter object" : u !== void 0 && (!Array.isArray(u) || u.some((e) => typeof e != "string" || e === "")) ? "\"paths\" must be a list of non-empty paths" : l(e, "timeout", ["constant", "factor"]) ?? l(e, "hitLimit", ["factor", "floor"]);
|
|
36
37
|
}
|
|
37
38
|
function c(a) {
|
|
38
39
|
if (a === void 0) return "it must have a default export";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the `package.json` of the installed package a file lies in: the one in
|
|
3
|
+
* the directory under the last `node_modules` of its path, `@scope/name`
|
|
4
|
+
* included, whose `main` and `exports` decide what an import of the package
|
|
5
|
+
* resolves to, also when a `package.json` closer to the file only decides its
|
|
6
|
+
* format.
|
|
7
|
+
*
|
|
8
|
+
* @param file - Absolute path.
|
|
9
|
+
* @returns Absolute path of the manifest, or null for a file that lies in no
|
|
10
|
+
* package under `node_modules`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPackageManifest(file: string): string | null;
|