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
|
@@ -119,7 +119,11 @@ interface CandidateCollection {
|
|
|
119
119
|
* only it knows which link it removes. A replacement that a visitor marks as
|
|
120
120
|
* skipped is never validated and never becomes a candidate; on request it is
|
|
121
121
|
* collected with its rule, like dropped and invalid replacements, so that
|
|
122
|
-
* skipped replacements never change the candidates.
|
|
122
|
+
* skipped replacements never change the candidates. Its rule is checked in
|
|
123
|
+
* every run: it is one of the skip rules of the mutator's plugin, else a
|
|
124
|
+
* built-in rule (see `findSkipRule`); a skip with any other rule is a mutator
|
|
125
|
+
* error, and its replacement is dropped. Rules of the collection itself, such
|
|
126
|
+
* as a timer delay, are built-in rules whatever the mutator. In a template only
|
|
123
127
|
* expressions are replaced: a replacement of a statement, a declaration or a
|
|
124
128
|
* node of the synthetic module around the template code is dropped without a
|
|
125
129
|
* trace, and every candidate has the scope `<template>`. A replacement in a Vue
|
|
@@ -5,49 +5,61 @@ import { findCompilerPins as r } from "../syntax/find-compiler-pins.js";
|
|
|
5
5
|
import { removeListElement as i } from "../text/remove-list-element.js";
|
|
6
6
|
import { readLiteralType as a } from "../syntax/read-literal-type.js";
|
|
7
7
|
import { validateReplacement as o } from "./validate-replacement.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
8
|
+
import { findClosestName as s } from "../text/find-closest-name.js";
|
|
9
|
+
import { findIgnoreRule as c } from "../ignore/find-ignore-rule.js";
|
|
10
|
+
import { getReplacementKind as l } from "./get-replacement-kind.js";
|
|
11
|
+
import { parseExpression as u } from "../text/parse-expression.js";
|
|
12
|
+
import { getScopePath as d } from "../identity/get-scope-path.js";
|
|
13
|
+
import { groupReplacement as f } from "./group-replacement.js";
|
|
14
|
+
import { fitTemplateText as p } from "./fit-template-text.js";
|
|
15
|
+
import { findListRemoval as m } from "./find-list-removal.js";
|
|
16
|
+
import { getMutantSite as h } from "./get-mutant-site.js";
|
|
17
|
+
import { skipRules as g } from "../skips/skip-rules.js";
|
|
18
|
+
import { getSlot as _ } from "../tree/get-slot.js";
|
|
19
|
+
import { pickFocus as v } from "./pick-focus.js";
|
|
20
|
+
const y = {
|
|
19
21
|
reason: "it only changes a timer delay",
|
|
20
22
|
rule: "timer-delay"
|
|
21
23
|
};
|
|
22
|
-
function
|
|
23
|
-
let { services:
|
|
24
|
-
function
|
|
25
|
-
if (
|
|
26
|
-
let {
|
|
27
|
-
|
|
28
|
-
by:
|
|
29
|
-
start:
|
|
30
|
-
mutator:
|
|
24
|
+
function b(s) {
|
|
25
|
+
let { services: b, parsed: E, rules: D, tree: O } = s, k = E.language === "typescript" ? "ts" : "js", A = [], j = [], M = [];
|
|
26
|
+
function N(e, t, n) {
|
|
27
|
+
if (s.skipped) {
|
|
28
|
+
let { rule: r, by: i } = n;
|
|
29
|
+
M.push({
|
|
30
|
+
by: i ? {
|
|
31
|
+
start: i.node.start,
|
|
32
|
+
mutator: i.mutator,
|
|
31
33
|
id: null
|
|
32
34
|
} : null,
|
|
33
|
-
heuristic: n.heuristic === !0,
|
|
34
|
-
emission:
|
|
35
|
+
heuristic: r.heuristic || n.heuristic === !0,
|
|
36
|
+
emission: M.length,
|
|
37
|
+
category: r.category,
|
|
35
38
|
start: t.start,
|
|
36
39
|
reason: n.reason,
|
|
37
40
|
kind: t.kind,
|
|
38
41
|
text: t.text,
|
|
39
42
|
end: t.end,
|
|
40
|
-
rule:
|
|
43
|
+
rule: r.id,
|
|
41
44
|
registered: e,
|
|
42
|
-
...
|
|
45
|
+
...v(t)
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
function
|
|
49
|
+
function P(e, t, n) {
|
|
50
|
+
N(e, t, {
|
|
51
|
+
...n,
|
|
52
|
+
rule: {
|
|
53
|
+
...g[n.rule],
|
|
54
|
+
id: n.rule
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function F(e, n, r) {
|
|
47
59
|
if (r?.narrow) {
|
|
48
60
|
let { start: e, end: i } = n.node;
|
|
49
61
|
return {
|
|
50
|
-
...t(
|
|
62
|
+
...t(E, r.list, r.index),
|
|
51
63
|
list: {
|
|
52
64
|
start: r.list.start,
|
|
53
65
|
end: r.list.end
|
|
@@ -62,147 +74,151 @@ function v(v) {
|
|
|
62
74
|
};
|
|
63
75
|
}
|
|
64
76
|
let a = r === null ? n : {
|
|
65
|
-
text: i(
|
|
77
|
+
text: i(E, r.list, r.index),
|
|
66
78
|
node: r.list
|
|
67
|
-
}, { node: o, text: s } =
|
|
68
|
-
parsed:
|
|
69
|
-
tree:
|
|
79
|
+
}, { node: o, text: s } = f(a, {
|
|
80
|
+
parsed: E,
|
|
81
|
+
tree: O
|
|
70
82
|
}, e.id.includes("/"));
|
|
71
83
|
return {
|
|
72
|
-
kind:
|
|
84
|
+
kind: l(o),
|
|
73
85
|
start: o.start,
|
|
74
86
|
end: o.end,
|
|
75
87
|
text: s,
|
|
76
|
-
...
|
|
88
|
+
...v(a)
|
|
77
89
|
};
|
|
78
90
|
}
|
|
79
|
-
function
|
|
80
|
-
let { syntax: n } =
|
|
91
|
+
function I(e, t) {
|
|
92
|
+
let { syntax: n } = b;
|
|
81
93
|
if (!n.isRuntimeNode(e) || !n.isTimerDelay(e)) return !1;
|
|
82
94
|
let r = a(e);
|
|
83
95
|
if (r === null) return !1;
|
|
84
|
-
let i =
|
|
96
|
+
let i = u(t, k);
|
|
85
97
|
return i !== null && a(i) === r;
|
|
86
98
|
}
|
|
87
|
-
function
|
|
88
|
-
if (e.kind !== "element" && e.kind !== "property") return
|
|
89
|
-
let n =
|
|
99
|
+
function L(e, t) {
|
|
100
|
+
if (e.kind !== "element" && e.kind !== "property") return p(e.text, t, k);
|
|
101
|
+
let n = E.text.slice(e.start - 1, e.start) + E.text.slice(e.end, e.end + 1), r = p(n, t, k);
|
|
90
102
|
return r.kind === "fit" ? {
|
|
91
103
|
text: e.text,
|
|
92
104
|
kind: "fit"
|
|
93
105
|
} : r;
|
|
94
106
|
}
|
|
95
|
-
function
|
|
96
|
-
let i =
|
|
97
|
-
if (
|
|
98
|
-
let
|
|
99
|
-
|
|
107
|
+
function R(e, t, r) {
|
|
108
|
+
let i = m(O, r, V), a = i?.list ?? r.node;
|
|
109
|
+
if (B !== null && (B.has(a) || l(a) !== "expression")) return;
|
|
110
|
+
let u = i !== null && !i.narrow && i.copies > 8;
|
|
111
|
+
u && i !== null && (i = {
|
|
100
112
|
...i,
|
|
101
113
|
narrow: !0
|
|
102
114
|
});
|
|
103
|
-
let
|
|
115
|
+
let f = F(e, r, i);
|
|
104
116
|
if (r.skip) {
|
|
105
|
-
|
|
117
|
+
let { rule: n } = r.skip, i = w(e, n);
|
|
118
|
+
i === null ? A.push(C(E, t, S(e, n))) : I(a, f.text) ? P(e, f, y) : N(e, f, {
|
|
119
|
+
...r.skip,
|
|
120
|
+
rule: i
|
|
121
|
+
});
|
|
106
122
|
return;
|
|
107
123
|
}
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
...
|
|
124
|
+
let p = i === null && r.text === "" && f.kind === "expression", g = p ? `returned an empty text for a ${a.type} node; only an element of an array literal or a member of an object literal is removed with an empty text.` : o(O, a, f);
|
|
125
|
+
if (g !== null) {
|
|
126
|
+
A.push(C(E, t, `Mutator "${e.id}" ${g}`)), P(e, p ? {
|
|
127
|
+
...f,
|
|
112
128
|
text: ""
|
|
113
|
-
} :
|
|
114
|
-
reason: `the mutator ${
|
|
129
|
+
} : f, {
|
|
130
|
+
reason: `the mutator ${g.slice(0, -1)}`,
|
|
115
131
|
rule: "invalid-target"
|
|
116
132
|
});
|
|
117
133
|
return;
|
|
118
134
|
}
|
|
119
|
-
let { start:
|
|
135
|
+
let { start: _, end: x } = a, k = z.find((e) => _ <= e.start && e.end <= x && e.region.start <= _ && x <= e.region.end);
|
|
120
136
|
if (k) {
|
|
121
|
-
|
|
137
|
+
P(e, f, {
|
|
122
138
|
rule: "compiler-macro",
|
|
123
139
|
reason: k.reason
|
|
124
140
|
});
|
|
125
141
|
return;
|
|
126
142
|
}
|
|
127
|
-
let
|
|
143
|
+
let M = s.expressions?.findLast((e) => e.start <= _)?.delimiter, R = M === void 0 ? {
|
|
128
144
|
kind: "fit",
|
|
129
|
-
text:
|
|
130
|
-
} :
|
|
145
|
+
text: f.text
|
|
146
|
+
} : L(f, M);
|
|
131
147
|
if (R.kind === "unfit") {
|
|
132
|
-
|
|
148
|
+
P(e, f, {
|
|
133
149
|
rule: "template-text",
|
|
134
150
|
reason: R.reason
|
|
135
151
|
});
|
|
136
152
|
return;
|
|
137
153
|
}
|
|
138
|
-
if (
|
|
139
|
-
|
|
154
|
+
if (I(a, f.text)) {
|
|
155
|
+
P(e, f, y);
|
|
140
156
|
return;
|
|
141
157
|
}
|
|
142
|
-
if (!
|
|
143
|
-
|
|
158
|
+
if (!b.settings.timeouts && e.id !== "optional-chaining" && b.syntax.isLoopAdvanceValue(a)) {
|
|
159
|
+
P(e, f, {
|
|
144
160
|
reason: "it changes the value that advances a loop, so it may keep the loop running forever",
|
|
145
161
|
rule: "loop-advance"
|
|
146
162
|
});
|
|
147
163
|
return;
|
|
148
164
|
}
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
reason: `removing it takes a copy of the whole literal, which Mootant does not make for a literal with more than 8 such ${
|
|
165
|
+
if (u) {
|
|
166
|
+
P(e, f, {
|
|
167
|
+
reason: `removing it takes a copy of the whole literal, which Mootant does not make for a literal with more than 8 such ${f.kind === "element" ? "elements" : "members"}`,
|
|
152
168
|
rule: "literal-copies"
|
|
153
169
|
});
|
|
154
170
|
return;
|
|
155
171
|
}
|
|
156
|
-
let
|
|
157
|
-
focus:
|
|
158
|
-
kind:
|
|
159
|
-
list:
|
|
172
|
+
let H = f.kind === "element" || f.kind === "property" ? {
|
|
173
|
+
focus: f.focus,
|
|
174
|
+
kind: f.kind,
|
|
175
|
+
list: f.list
|
|
160
176
|
} : {
|
|
161
|
-
kind:
|
|
162
|
-
...
|
|
163
|
-
},
|
|
164
|
-
...
|
|
165
|
-
start:
|
|
177
|
+
kind: f.kind,
|
|
178
|
+
...v(f)
|
|
179
|
+
}, U = h({
|
|
180
|
+
...H,
|
|
181
|
+
start: f.start
|
|
166
182
|
});
|
|
167
|
-
|
|
168
|
-
ignoreRule:
|
|
169
|
-
line: n(
|
|
183
|
+
j.push({
|
|
184
|
+
ignoreRule: c(D, {
|
|
185
|
+
line: n(E.lineStarts, U).line,
|
|
170
186
|
mutator: e.id,
|
|
171
|
-
start:
|
|
187
|
+
start: U
|
|
172
188
|
}),
|
|
173
|
-
scope:
|
|
174
|
-
solitary:
|
|
175
|
-
emission:
|
|
176
|
-
start:
|
|
177
|
-
end:
|
|
189
|
+
scope: B === null ? d(O, a) : "<template>",
|
|
190
|
+
solitary: T(r.solitary),
|
|
191
|
+
emission: j.length,
|
|
192
|
+
start: f.start,
|
|
193
|
+
end: f.end,
|
|
178
194
|
text: R.text,
|
|
179
195
|
registered: e,
|
|
180
|
-
...
|
|
196
|
+
...H
|
|
181
197
|
});
|
|
182
198
|
}
|
|
183
|
-
let
|
|
184
|
-
for (let e of
|
|
185
|
-
let t =
|
|
199
|
+
let z = r(O, E.file), B = s.hosts ?? null, V = B !== null && e(E.file) === "svelte", H = x(s, A);
|
|
200
|
+
for (let e of O.order) {
|
|
201
|
+
let t = H.get(e.type);
|
|
186
202
|
if (!t) continue;
|
|
187
|
-
let { parent: n } =
|
|
203
|
+
let { parent: n } = _(O, e);
|
|
188
204
|
for (let { registered: r, visit: i } of t) {
|
|
189
205
|
let t;
|
|
190
206
|
try {
|
|
191
207
|
t = i(e, n);
|
|
192
208
|
} catch (t) {
|
|
193
|
-
|
|
209
|
+
A.push(C(E, e, `Mutator "${r.id}" failed on ${e.type}: ${t.message}`));
|
|
194
210
|
continue;
|
|
195
211
|
}
|
|
196
|
-
for (let n of t)
|
|
212
|
+
for (let n of t) R(r, e, n);
|
|
197
213
|
}
|
|
198
214
|
}
|
|
199
215
|
return {
|
|
200
|
-
diagnostics:
|
|
201
|
-
candidates:
|
|
202
|
-
skipped:
|
|
216
|
+
diagnostics: A,
|
|
217
|
+
candidates: j,
|
|
218
|
+
skipped: M
|
|
203
219
|
};
|
|
204
220
|
}
|
|
205
|
-
function
|
|
221
|
+
function x(e, t) {
|
|
206
222
|
let { services: n, mutators: r, parsed: i } = e, a = /* @__PURE__ */ new Map();
|
|
207
223
|
for (let e of r) {
|
|
208
224
|
let r;
|
|
@@ -214,7 +230,7 @@ function y(e, t) {
|
|
|
214
230
|
file: i.file
|
|
215
231
|
});
|
|
216
232
|
} catch (n) {
|
|
217
|
-
t.push(
|
|
233
|
+
t.push(C(i, null, `Mutator "${e.id}" failed while preparing the file: ${n.message}`));
|
|
218
234
|
continue;
|
|
219
235
|
}
|
|
220
236
|
for (let [t, n] of Object.entries(r)) {
|
|
@@ -227,7 +243,13 @@ function y(e, t) {
|
|
|
227
243
|
}
|
|
228
244
|
return a;
|
|
229
245
|
}
|
|
230
|
-
function
|
|
246
|
+
function S(e, t) {
|
|
247
|
+
let n = `Mutator "${e.id}" returned a skip`;
|
|
248
|
+
if (typeof t != "string") return `${n} whose rule is not a string.`;
|
|
249
|
+
let r = `${n} with the unknown rule "${t}".`, i = s(t.slice(t.lastIndexOf("/") + 1), [...e.skipRules?.keys() ?? [], ...Object.keys(g)]);
|
|
250
|
+
return i === null ? e.skipRules ? `${r} Declare it in the skipRules of its plugin.` : r : `${r} Did you mean "${i}"?`;
|
|
251
|
+
}
|
|
252
|
+
function C(e, t, r) {
|
|
231
253
|
let i = t === null ? null : n(e.lineStarts, t.start);
|
|
232
254
|
return {
|
|
233
255
|
column: i?.column ?? null,
|
|
@@ -238,10 +260,16 @@ function b(e, t, r) {
|
|
|
238
260
|
message: r
|
|
239
261
|
};
|
|
240
262
|
}
|
|
241
|
-
function
|
|
263
|
+
function w(e, t) {
|
|
264
|
+
return typeof t == "string" ? e.skipRules?.get(t) || (Object.hasOwn(g, t) ? {
|
|
265
|
+
...g[t],
|
|
266
|
+
id: t
|
|
267
|
+
} : null) : null;
|
|
268
|
+
}
|
|
269
|
+
function T(e) {
|
|
242
270
|
return !e || e.length === 0 ? null : e.map(({ start: e, end: t }) => ({
|
|
243
271
|
start: e,
|
|
244
272
|
end: t
|
|
245
273
|
}));
|
|
246
274
|
}
|
|
247
|
-
export {
|
|
275
|
+
export { b as collectCandidates };
|
|
@@ -80,7 +80,7 @@ function k(e, t) {
|
|
|
80
80
|
text: e.text,
|
|
81
81
|
kind: e.kind,
|
|
82
82
|
end: e.end,
|
|
83
|
-
|
|
83
|
+
...w[n.rule],
|
|
84
84
|
...E(e),
|
|
85
85
|
...n
|
|
86
86
|
};
|
|
@@ -94,9 +94,9 @@ function k(e, t) {
|
|
|
94
94
|
rule: "duplicate"
|
|
95
95
|
}));
|
|
96
96
|
return [...r, ...c].toSorted(v).map((e) => ({
|
|
97
|
-
...w[e.rule],
|
|
98
|
-
heuristic: w[e.rule].heuristic || e.heuristic,
|
|
99
97
|
mutator: e.registered.id,
|
|
98
|
+
heuristic: e.heuristic,
|
|
99
|
+
category: e.category,
|
|
100
100
|
replacement: e.text,
|
|
101
101
|
reason: e.reason,
|
|
102
102
|
start: e.start,
|
|
@@ -190,16 +190,17 @@ function N(e, t, r) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
function P(e) {
|
|
193
|
+
let t = "log-message";
|
|
193
194
|
return {
|
|
194
195
|
reason: e.kind === "block" ? "it only removes a log message" : "it only changes the text of a log message",
|
|
195
196
|
registered: e.registered,
|
|
197
|
+
...w[t],
|
|
196
198
|
emission: e.emission,
|
|
197
199
|
start: e.start,
|
|
198
200
|
text: e.text,
|
|
199
201
|
kind: e.kind,
|
|
200
|
-
rule: "log-message",
|
|
201
202
|
end: e.end,
|
|
202
|
-
|
|
203
|
+
rule: t,
|
|
203
204
|
...E(e),
|
|
204
205
|
by: null
|
|
205
206
|
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { IsolatedResult, IsolatedFacts, } from '../types/adapter/isolated-result.js';
|
|
2
2
|
export type { BatchPlan, BatchUnit, BatchTest, } from '../types/adapter/batch-plan.js';
|
|
3
3
|
export type { IsolatedPlan, IsolatedUnit } from '../types/adapter/isolated-plan.js';
|
|
4
|
+
export type { OperatorExpression } from '../types/syntax/operator-expression.js';
|
|
4
5
|
export { resolveSwitchedText } from './instrument/resolve-switched-text.js';
|
|
5
6
|
export type { MutatorVisitors } from '../types/mutator/mutator-visitors.js';
|
|
6
7
|
export type { MutatorContext } from '../types/mutator/mutator-context.js';
|
|
@@ -9,23 +10,40 @@ export type { AdapterSession } from '../types/adapter/adapter-session.js';
|
|
|
9
10
|
export type { AdapterContext } from '../types/adapter/adapter-context.js';
|
|
10
11
|
export type { PresetSettings } from '../types/config/preset-settings.js';
|
|
11
12
|
export type { DryRunRequest } from '../types/adapter/dry-run-request.js';
|
|
13
|
+
export type { ListExpression } from '../types/syntax/list-expression.js';
|
|
14
|
+
export type { SourcePosition } from '../types/source/source-position.js';
|
|
12
15
|
export type { MutantRuntime } from '../types/adapter/mutant-runtime.js';
|
|
13
16
|
export type { DryRunResult } from '../types/adapter/dry-run-result.js';
|
|
17
|
+
export type { SyntaxHelpers } from '../types/syntax/syntax-helpers.js';
|
|
14
18
|
export type { SwitchedFile } from '../types/adapter/switched-file.js';
|
|
19
|
+
export type { SkipCategory } from '../types/mutant/skip-category.js';
|
|
15
20
|
export type { MutatorMeta } from '../types/mutator/mutator-meta.js';
|
|
16
21
|
export type { BatchResult } from '../types/adapter/batch-result.js';
|
|
17
22
|
export type { TestAdapter } from '../types/adapter/test-adapter.js';
|
|
23
|
+
export type { InferredType } from '../types/hints/inferred-type.js';
|
|
18
24
|
export type { Replacement } from '../types/mutator/replacement.js';
|
|
25
|
+
export type { SourceRange } from '../types/source/source-range.js';
|
|
26
|
+
export type { SourceCode } from '../types/source/source-code.js';
|
|
27
|
+
export type { ValueBound } from '../types/syntax/value-bound.js';
|
|
19
28
|
export type { TryLimits } from '../types/adapter/try-limits.js';
|
|
29
|
+
export type { TimerCall } from '../types/syntax/timer-call.js';
|
|
20
30
|
export type { TryVerdict } from '../types/run/try-verdict.js';
|
|
21
31
|
export type { TryFacts } from '../types/adapter/try-facts.js';
|
|
32
|
+
export type { TypeHints } from '../types/hints/type-hints.js';
|
|
33
|
+
export type { ValueKind } from '../types/hints/value-kind.js';
|
|
34
|
+
export type { SkipNote } from '../types/mutant/skip-note.js';
|
|
35
|
+
export type { TextEdit } from '../types/source/text-edit.js';
|
|
36
|
+
export type { SkipRule } from '../types/mutant/skip-rule.js';
|
|
37
|
+
export type { NodeSlot } from '../types/syntax/node-slot.js';
|
|
22
38
|
export type { UnitEnd } from '../types/adapter/unit-end.js';
|
|
23
39
|
export type { DryFile } from '../types/adapter/dry-file.js';
|
|
24
40
|
export type { DryTest } from '../types/adapter/dry-test.js';
|
|
25
41
|
export type { Mutator } from '../types/mutator/mutator.js';
|
|
26
42
|
export type { TryCause } from '../types/run/try-cause.js';
|
|
43
|
+
export type { Binding } from '../types/syntax/binding.js';
|
|
27
44
|
export { defineConfig } from './config/define-config.js';
|
|
28
45
|
export type { Config } from '../types/config/config.js';
|
|
29
46
|
export type { Plugin } from '../types/config/plugin.js';
|
|
30
47
|
export type { Preset } from '../types/config/preset.js';
|
|
31
48
|
export { classifyTry } from './run/classify-try.js';
|
|
49
|
+
export type * as AST from 'oxc-parser';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
2
|
import { LiteralChange } from '../../../types/syntax/literal-change.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
import { RunContext } from './create-run-context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Decides whether a literal mutant of a branch is skipped because it forces the
|
|
@@ -26,4 +26,4 @@ import { RunContext } from './create-run-context.js';
|
|
|
26
26
|
* @param context - Mutator context with the test of mutants that will run.
|
|
27
27
|
* @returns Rule and reason of the skip, or null when the mutant is emitted.
|
|
28
28
|
*/
|
|
29
|
-
export declare function getBranchCopySkip(node: Node, replacement: LiteralChange, context: RunContext):
|
|
29
|
+
export declare function getBranchCopySkip(node: Node, replacement: LiteralChange, context: RunContext): CoreNote | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PrivateInExpression, BinaryExpression } from 'oxc-parser';
|
|
2
2
|
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
3
|
import { Replacement } from '../../../types/mutator/replacement.js';
|
|
4
|
-
import {
|
|
4
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
5
5
|
/**
|
|
6
6
|
* Entries comparison-operator emits for a comparison, and those it skips.
|
|
7
7
|
*/
|
|
@@ -12,7 +12,7 @@ export interface ComparisonPlan {
|
|
|
12
12
|
* that a lower bound leaves equal to the constant, or the lower bound itself
|
|
13
13
|
* when it makes every input where the constant differs impossible.
|
|
14
14
|
*/
|
|
15
|
-
skippedConstants: Map<boolean,
|
|
15
|
+
skippedConstants: Map<boolean, CoreNote>;
|
|
16
16
|
/**
|
|
17
17
|
* Entries that are emitted, in emission order.
|
|
18
18
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObjectPropertyKind, ObjectExpression } from 'oxc-parser';
|
|
2
2
|
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
/**
|
|
5
5
|
* Decides whether the removal of a member of an object literal is skipped
|
|
6
6
|
* because the member sets an option of an `Intl` constructor to its default,
|
|
@@ -22,4 +22,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
22
22
|
* @param context - Mutator context.
|
|
23
23
|
* @returns Rule and reason of the skip, or null when the removal is emitted.
|
|
24
24
|
*/
|
|
25
|
-
export declare function getDefaultOptionSkip(property: ObjectPropertyKind, node: ObjectExpression, context: MutatorContext):
|
|
25
|
+
export declare function getDefaultOptionSkip(property: ObjectPropertyKind, node: ObjectExpression, context: MutatorContext): CoreNote | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogicalExpression } from 'oxc-parser';
|
|
2
|
-
import {
|
|
2
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
3
3
|
import { RunContext } from './create-run-context.js';
|
|
4
4
|
/**
|
|
5
5
|
* Whether logical-operator gives a group its absorbing constant.
|
|
@@ -8,7 +8,7 @@ export interface GroupConstant {
|
|
|
8
8
|
/**
|
|
9
9
|
* Why the constant is not emitted on a node that could have it, or null.
|
|
10
10
|
*/
|
|
11
|
-
skip:
|
|
11
|
+
skip: CoreNote | null;
|
|
12
12
|
/**
|
|
13
13
|
* Whether the constant is emitted.
|
|
14
14
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
2
|
import { LiteralChange } from '../../../types/syntax/literal-change.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
import { RunContext } from './create-run-context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Change of a literal and the rules of its own mutator.
|
|
@@ -10,7 +10,7 @@ interface LiteralSkipQuery {
|
|
|
10
10
|
* Rules of the literal's own mutator, checked after the operand and error
|
|
11
11
|
* message rules; omitted when the mutator has none.
|
|
12
12
|
*/
|
|
13
|
-
getOwnSkip?():
|
|
13
|
+
getOwnSkip?(): CoreNote | null;
|
|
14
14
|
/**
|
|
15
15
|
* New value of the literal, or new text of a template with expressions.
|
|
16
16
|
*/
|
|
@@ -34,5 +34,5 @@ interface LiteralSkipQuery {
|
|
|
34
34
|
* @param context - Mutator context with the test of mutants that will run.
|
|
35
35
|
* @returns Rule and reason of the skip, or null when no rule skips the change.
|
|
36
36
|
*/
|
|
37
|
-
export declare function getLiteralSkip(node: Node, query: LiteralSkipQuery, context: RunContext):
|
|
37
|
+
export declare function getLiteralSkip(node: Node, query: LiteralSkipQuery, context: RunContext): CoreNote | null;
|
|
38
38
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Builds the skip of a constant that gives a loop its running value, so the
|
|
4
4
|
* loop may never end.
|
|
@@ -6,4 +6,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
6
6
|
* @param value - Constant that keeps the loop running.
|
|
7
7
|
* @returns Rule and reason of the skip.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getLoopRunningSkip(value: boolean):
|
|
9
|
+
export declare function getLoopRunningSkip(value: boolean): CoreNote;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogicalExpression } from 'oxc-parser';
|
|
2
2
|
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
/**
|
|
5
5
|
* Finds why the swap between `??` and `||` of a logical expression is not
|
|
6
6
|
* emitted (catalog 4.8): under every `nullishSwap` mode it is equivalent when
|
|
@@ -13,4 +13,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
13
13
|
* @param nullishSwap - The `nullishSwap` option of logical-operator.
|
|
14
14
|
* @returns Rule and reason of the skip, or null when the swap is emitted.
|
|
15
15
|
*/
|
|
16
|
-
export declare function getNullishSwapSkip(node: LogicalExpression, context: MutatorContext, nullishSwap: 'distinguishing' | 'always'):
|
|
16
|
+
export declare function getNullishSwapSkip(node: LogicalExpression, context: MutatorContext, nullishSwap: 'distinguishing' | 'always'): CoreNote | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
|
-
import {
|
|
2
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
3
3
|
import { LiteralValue } from './get-literal-value.js';
|
|
4
4
|
import { RunContext } from './create-run-context.js';
|
|
5
5
|
/**
|
|
@@ -15,4 +15,4 @@ import { RunContext } from './create-run-context.js';
|
|
|
15
15
|
* @param context - Mutator context with the test of mutants that will run.
|
|
16
16
|
* @returns Rule and reason of the skip, or null when the mutant is emitted.
|
|
17
17
|
*/
|
|
18
|
-
export declare function getOrDefaultSkip(node: Node, value: LiteralValue, context: RunContext):
|
|
18
|
+
export declare function getOrDefaultSkip(node: Node, value: LiteralValue, context: RunContext): CoreNote | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
2
|
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
/**
|
|
5
5
|
* Finds the constants of a node that logical-operator owns (catalog 4.6, rule
|
|
6
6
|
* 2, O3): both in a boolean-mode operand, an operand of a `&&` or `||` in
|
|
@@ -14,4 +14,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
14
14
|
* @param context - Mutator context of the file.
|
|
15
15
|
* @returns The skip of each owned constant.
|
|
16
16
|
*/
|
|
17
|
-
export declare function getOwnedConstants(node: Node, context: MutatorContext): Map<boolean,
|
|
17
|
+
export declare function getOwnedConstants(node: Node, context: MutatorContext): Map<boolean, CoreNote>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Skip of the leave-now constant of a first exit test, which is the loop's
|
|
4
4
|
* never-run mutant (catalog O13).
|
|
5
5
|
*/
|
|
6
|
-
export declare const LEAVE_NOW_SKIP:
|
|
6
|
+
export declare const LEAVE_NOW_SKIP: CoreNote;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Skip of a mutant that makes a callback a no-op, which is method-call's
|
|
4
4
|
* removal of the call (catalog O12).
|
|
5
5
|
*/
|
|
6
|
-
export declare const NO_OP_CALLBACK_SKIP:
|
|
6
|
+
export declare const NO_OP_CALLBACK_SKIP: CoreNote;
|
|
@@ -5,13 +5,15 @@ import { Plugin } from '../../types/config/plugin.js';
|
|
|
5
5
|
* plugins under their full ids. Mutators are ranked in canonical order: core
|
|
6
6
|
* mutators by name, then the plugins by namespace and the mutators of each
|
|
7
7
|
* plugin by name, so the order of object keys in plugin files never matters.
|
|
8
|
+
* Every mutator of a namespaced plugin gets the skip rules of its plugin, keyed
|
|
9
|
+
* by name, each with its full id; a built-in mutator gets none.
|
|
8
10
|
*
|
|
9
11
|
* @param core - Plugin of the built-in mutators and presets, without a
|
|
10
12
|
* namespace.
|
|
11
13
|
* @param plugins - Other plugins keyed by the namespace that prefixes their
|
|
12
14
|
* ids.
|
|
13
15
|
* @returns Mutators in rank order and presets, keyed by full id.
|
|
14
|
-
* @throws Error - When a namespace, mutator name
|
|
15
|
-
* kebab-case.
|
|
16
|
+
* @throws Error - When a namespace, mutator name, preset name or skip rule name
|
|
17
|
+
* is not kebab-case.
|
|
16
18
|
*/
|
|
17
19
|
export declare function createMutatorRegistry(core: Plugin, plugins: Record<string, Plugin>): MutatorRegistry;
|