@systemfsoftware/stryker-ignorer-in-source-vitest-block 0.0.0 → 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @systemfsoftware/stryker-ignorer-in-source-vitest-block
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Effect moves to `4.0.0-rc.116` (with `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/vitest` and `@effect/opentelemetry` on the same release), the `@systemfsoftware/*` toolchain pins move to their current releases, and `vitest` 5 with `oxc-parser` 0.150 come along. Both worker bundles (`stryker-js-typescript-checker`, `stryker-js-vitest-runner`) now inline their whole runtime rather than resolving `effect`, `@effect/*` and the sibling packages from the host's tree, so a worker runs on its own copy of the effect that built it; the project's `typescript` and `vitest` remain the only imports beside Node builtins. The filter-level `arbitrary.candidate` generators that the thresholds schemas carried are gone: v4 no longer reads them, so thresholds still reject a `low` above `high` and the property tests generate the pair from the schema again. Log calls inside `Effect.catch*` handlers moved to `Effect.tapError`/`Effect.tapCause` at the same level and message. `@systemfsoftware/stryker-ignorer-interface` re-exports the 0.150 AST, where `FormalParameterRest.decorators` is now `Array<Decorator>`.
8
+
9
+ ## 0.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - First release. This ignorer keeps mutants inside a test-only block out of a
14
+ mutation run: those statements never reach the production path, so no run can
15
+ observe the change.
16
+
17
+ It has no runtime dependencies, and migrating from the plugin you use today is a
18
+ rename in your plugins list — the ignorer keeps the name it already had.
19
+
20
+ - Removed the `decideInSourceTestIgnore` and `isInSourceTestGuard` exports. The ignorer still
21
+ registers under the name `in-source-vitest-block` with unchanged recognized guard shapes and
22
+ unchanged ignore reasons. If you called the decision function directly, consult the
23
+ descriptor instead: `strykerIgnorers[0].shouldIgnore(node, ancestors)`.
24
+
25
+ ### Patch Changes
26
+
27
+ - Maintenance release. Every published entry point, export, option, and behaviour is exactly as it was.
package/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # @systemfsoftware/stryker-ignorer-in-source-vitest-block
2
2
 
3
- ![version](https://img.shields.io/npm/v/@systemfsoftware/stryker-ignorer-in-source-vitest-block)
4
- ![license](https://img.shields.io/npm/l/@systemfsoftware/stryker-ignorer-in-source-vitest-block)
3
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](../../../LICENSE)
4
+ [![npm version](https://img.shields.io/npm/v/@systemfsoftware/stryker-ignorer-in-source-vitest-block.svg)](https://www.npmjs.com/package/@systemfsoftware/stryker-ignorer-in-source-vitest-block)
5
5
 
6
- > In-source tests are not production behaviour. Stop their mutants from dragging your Stryker score below 100%.
6
+ > In-source tests are not production behavior. Stop their mutants from dragging your Stryker score below 100%.
7
7
 
8
- Your `if (import.meta.vitest)` blocks are stripped before production, so nothing that runs in a mutation run can ever reach their mutants. They sit in the report forever, indistinguishable from real coverage gaps. This [Stryker](https://stryker-mutator.io) ignorer removes them, so the score that remains is production behaviour.
8
+ Your `if (import.meta.vitest)` blocks are stripped before production, so code executing during mutation testing never reaches them. They sit in reports as false unkillable survivors.
9
+
10
+ This Stryker ignorer recognizes and skips mutants inside `import.meta.vitest` test guards, ensuring 100% mutation testing accuracy.
9
11
 
10
12
  ## Install
11
13
 
@@ -13,59 +15,33 @@ Your `if (import.meta.vitest)` blocks are stripped before production, so nothing
13
15
  pnpm add -D @systemfsoftware/stryker-ignorer-in-source-vitest-block
14
16
  ```
15
17
 
16
- In `stryker.config.ts`, the plugin module and the ignorer name travel as a pair:
18
+ ## Setup in `stryker.config.ts`
17
19
 
18
- | Config key | Value |
19
- | ---------- | --------------------------------------------------------- |
20
- | `plugins` | `@systemfsoftware/stryker-ignorer-in-source-vitest-block` |
21
- | `ignorers` | `in-source-vitest-block` |
20
+ Add the plugin URL to `ignorers`. Every ignorer the module exports is then active.
22
21
 
23
22
  ```ts
24
- export default {
25
- plugins: [
26
- '@systemfsoftware/stryker-js-vitest-runner',
27
- '@systemfsoftware/stryker-js-typescript-checker',
28
- '@systemfsoftware/stryker-ignorer-in-source-vitest-block',
23
+ import { defineConfig } from '@systemfsoftware/stryker-js/config'
24
+
25
+ export default defineConfig({
26
+ testRunner: {
27
+ plugin: import.meta.resolve('@systemfsoftware/stryker-js-vitest-runner'),
28
+ },
29
+ ignorers: [
30
+ import.meta.resolve('@systemfsoftware/stryker-ignorer-in-source-vitest-block'),
29
31
  ],
30
- ignorers: ['in-source-vitest-block'],
31
- }
32
+ })
32
33
  ```
33
34
 
34
- Mutants it recognizes are reported as `Ignored`, each carrying the reason it was safe to skip.
35
-
36
- > [!WARNING]
37
- > A name in `ignorers` that no loaded plugin answers is silently skipped — the run proceeds and the mutants stay in your score. Copy the name from the table, not from memory.
38
-
39
- > [!NOTE]
40
- > Requires `@systemfsoftware/stryker-js-engine` 4.1.0 or later (the first version whose plugin loader speaks the plain ignorer protocol). The package has no peer dependencies, no Effect dependency at all, and two dependencies — `@systemfsoftware/stryker-ignorer-interface`, whose node types declare the AST shapes the visitors read, and `@systemfsoftware/stryker-ignorer-kit`, which compiles the visitor declaration to the wire contract and verifies it from source snippets.
41
-
42
- ## Migrating from `@systemfsoftware/stryker-plugins`
43
-
44
- | Before | After |
45
- | ------------------------------------------------- | ------------------------------------------------------------------------ |
46
- | `"plugins": ["@systemfsoftware/stryker-plugins"]` | `"plugins": ["@systemfsoftware/stryker-ignorer-in-source-vitest-block"]` |
47
- | `"ignorers": ["in-source-vitest-block"]` | unchanged |
48
-
49
- ## What it ignores
50
-
51
- | Guard shape | Example |
52
- | ---------------------------------------------------------- | ----------------------------------------------- |
53
- | The bare Vitest flag | `if (import.meta.vitest) { … }` |
54
- | The flag on either side of a comparison | `if (import.meta.vitest === undefined) { … }` |
55
- | Any mutant whose ancestors include one of the guards above | the whole guarded block, test fixtures included |
56
-
57
- ## Where the line is
58
-
59
- The ignored mutants are _unreachable_, not merely believed equivalent: the guard is false under the mutation run, so no test can exercise what is inside it. That is a different claim from a proven-equivalent mutant, and it is why the reason constant says so.
60
-
61
- - A flag on a different meta property (`import.meta.env`) or on a non-import meta (`require.meta.vitest`) is **not** a guard — its mutants stay live.
62
- - A bare `import.meta.vitest` expression without an enclosing `if` is **not** a guard.
63
- - Only the guard shape is recognized; ordinary `if` statements keep every mutant, because their branches are reached in production.
35
+ Mutants inside guarded test blocks are reported as `Ignored`.
64
36
 
65
- ## Contributing
37
+ ## What It Ignores
66
38
 
67
- Development setup and workflow: [AGENTS.md](AGENTS.md).
39
+ | Guard Shape | Example |
40
+ | ---------------------------------- | ----------------------------------------------------- |
41
+ | Direct Vitest meta property check | `if (import.meta.vitest) { ... }` |
42
+ | Comparison check | `if (import.meta.vitest !== undefined) { ... }` |
43
+ | Enclosed declarations and fixtures | All test suites and utilities nested within the block |
68
44
 
69
45
  ## License
70
46
 
71
- [Apache 2.0](LICENSE)
47
+ [Apache-2.0](../../../LICENSE)
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { Ignorer } from "@systemfsoftware/stryker-ignorer-interface";
2
- //#region src/InSourceTestIgnore.d.ts
3
- export declare const IN_SOURCE_TEST_IGNORED: 'inside an `if (import.meta.vitest)` block — test code, not production behaviour';
4
- export declare const VITEST_META_PROPERTY: 'vitest';
5
- export declare const strykerIgnorers: readonly Ignorer[];
6
- //#endregion
1
+ import { Ignorer } from '@systemfsoftware/stryker-ignorer-interface';
2
+
3
+ export declare const IN_SOURCE_TEST_IGNORED: 'inside an `if (import.meta.vitest)` block — test code, not production behaviour';
4
+
5
+ export declare const strykerIgnorers: readonly Ignorer[];
6
+
7
+ export declare const VITEST_META_PROPERTY: 'vitest';
8
+
9
+ export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-ignorer-in-source-vitest-block",
3
3
  "license": "Apache-2.0",
4
- "version": "0.0.0",
4
+ "version": "0.1.1",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -31,23 +31,23 @@
31
31
  "./package.json": "./package.json"
32
32
  },
33
33
  "dependencies": {
34
- "@systemfsoftware/stryker-ignorer-interface": "^0.0.0",
35
- "@systemfsoftware/stryker-ignorer-kit": "^0.0.0"
34
+ "@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
35
+ "@systemfsoftware/stryker-ignorer-kit": "^0.1.1"
36
36
  },
37
37
  "devDependencies": {
38
+ "@effect/tsgo": "^0.45.0",
38
39
  "@microsoft/api-extractor": "^7",
39
- "@systemfsoftware/arethetypeswrong-cli": "^4",
40
- "@systemfsoftware/tsconfig": "^1",
40
+ "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
41
+ "@systemfsoftware/tsconfig": "^1.3.6",
41
42
  "@types/node": "^24",
42
- "@vitest/coverage-v8": "^4",
43
+ "@vitest/coverage-v8": "^5",
43
44
  "oxlint": "^1",
44
45
  "rimraf": "^6.1.3",
45
46
  "tsdown": "^0.23.0",
46
47
  "typescript": "^7",
47
- "vitest": "^4",
48
- "@effect/tsgo": "^0.45.0",
49
- "@systemfsoftware/oxlint-ignorer-config": "^0.0.0",
48
+ "vitest": "^5",
50
49
  "@systemfsoftware/vitest-config": "^0.1.0",
50
+ "@systemfsoftware/oxlint-ignorer-config": "^0.1.1",
51
51
  "@systemfsoftware/tsdown-config": "^0.1.0"
52
52
  },
53
53
  "publishConfig": {