testing-conventions 0.0.81 → 0.0.83
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/dist/mutation/mutation-cli.d.ts +3 -1
- package/dist/mutation/mutation-cli.js +8 -3
- package/dist/mutation/mutation-cli.js.map +1 -1
- package/dist/mutation/parse-args.d.ts +6 -2
- package/dist/mutation/parse-args.js +8 -2
- package/dist/mutation/parse-args.js.map +1 -1
- package/dist/mutation/run-stryker.d.ts +6 -0
- package/dist/mutation/run-stryker.js +1 -0
- package/dist/mutation/run-stryker.js.map +1 -1
- package/package.json +6 -6
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Stryker through the Node API and emits the normalized results as JSON. `--out <path>` writes
|
|
6
6
|
* them to a file (the rule passes a temp file, so Stryker's own stdout logging can't corrupt
|
|
7
7
|
* them); without it, the JSON goes to stdout. `--mutate <a,b,...>` scopes the run to those Stryker
|
|
8
|
-
* mutate patterns
|
|
8
|
+
* mutate patterns, and `--vitest-dir <path>` scopes vitest's test discovery to that directory
|
|
9
|
+
* (the scan path within the package). Rejects on a failed run; `main.ts` maps that onto a
|
|
10
|
+
* non-zero exit code.
|
|
9
11
|
*/
|
|
10
12
|
export declare function mutationCLI(argv: string[]): Promise<void>;
|
|
@@ -8,11 +8,16 @@ import { runStryker } from './run-stryker.js';
|
|
|
8
8
|
* Stryker through the Node API and emits the normalized results as JSON. `--out <path>` writes
|
|
9
9
|
* them to a file (the rule passes a temp file, so Stryker's own stdout logging can't corrupt
|
|
10
10
|
* them); without it, the JSON goes to stdout. `--mutate <a,b,...>` scopes the run to those Stryker
|
|
11
|
-
* mutate patterns
|
|
11
|
+
* mutate patterns, and `--vitest-dir <path>` scopes vitest's test discovery to that directory
|
|
12
|
+
* (the scan path within the package). Rejects on a failed run; `main.ts` maps that onto a
|
|
13
|
+
* non-zero exit code.
|
|
12
14
|
*/
|
|
13
15
|
export async function mutationCLI(argv) {
|
|
14
|
-
const { mutate, out } = parseArgs(argv);
|
|
15
|
-
const results = await runStryker(
|
|
16
|
+
const { mutate, out, vitestDir } = parseArgs(argv);
|
|
17
|
+
const results = await runStryker({
|
|
18
|
+
...(mutate === undefined ? {} : { mutate }),
|
|
19
|
+
...(vitestDir === undefined ? {} : { vitestDir }),
|
|
20
|
+
});
|
|
16
21
|
const json = `${JSON.stringify(results)}\n`;
|
|
17
22
|
if (out === undefined) {
|
|
18
23
|
process.stdout.write(json);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-cli.js","sourceRoot":"","sources":["../../src/mutation/mutation-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"mutation-cli.js","sourceRoot":"","sources":["../../src/mutation/mutation-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAc;IAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC;QAC/B,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;KAClD,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -4,11 +4,15 @@ export interface AdapterArgs {
|
|
|
4
4
|
mutate?: string[];
|
|
5
5
|
/** File to write the normalized-results JSON to (`--out <path>`); stdout when absent. */
|
|
6
6
|
out?: string;
|
|
7
|
+
/** Directory vitest discovers tests in (`--vitest-dir <path>`), relative to the project root. */
|
|
8
|
+
vitestDir?: string;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Parse the adapter's CLI arguments with Node's built-in `util.parseArgs`: `--out <path>` (where
|
|
10
12
|
* to write the normalized JSON — the rule passes a temp file so Stryker's own stdout logging can't
|
|
11
|
-
* corrupt the results)
|
|
12
|
-
*
|
|
13
|
+
* corrupt the results), `--mutate <a,b,...>` (Stryker mutate patterns, comma-split into a list),
|
|
14
|
+
* and `--vitest-dir <path>` (the directory vitest discovers tests in — the scan path within the
|
|
15
|
+
* package, so the colocated unit suite alone judges the mutants). All are optional; the rust
|
|
16
|
+
* binary supplies the argv, so it stays a fixed, controlled shape.
|
|
13
17
|
*/
|
|
14
18
|
export declare function parseArgs(argv: string[]): AdapterArgs;
|
|
@@ -2,8 +2,10 @@ import { parseArgs as parseNodeArgs } from 'node:util';
|
|
|
2
2
|
/**
|
|
3
3
|
* Parse the adapter's CLI arguments with Node's built-in `util.parseArgs`: `--out <path>` (where
|
|
4
4
|
* to write the normalized JSON — the rule passes a temp file so Stryker's own stdout logging can't
|
|
5
|
-
* corrupt the results)
|
|
6
|
-
*
|
|
5
|
+
* corrupt the results), `--mutate <a,b,...>` (Stryker mutate patterns, comma-split into a list),
|
|
6
|
+
* and `--vitest-dir <path>` (the directory vitest discovers tests in — the scan path within the
|
|
7
|
+
* package, so the colocated unit suite alone judges the mutants). All are optional; the rust
|
|
8
|
+
* binary supplies the argv, so it stays a fixed, controlled shape.
|
|
7
9
|
*/
|
|
8
10
|
export function parseArgs(argv) {
|
|
9
11
|
const { values } = parseNodeArgs({
|
|
@@ -11,6 +13,7 @@ export function parseArgs(argv) {
|
|
|
11
13
|
options: {
|
|
12
14
|
mutate: { type: 'string' },
|
|
13
15
|
out: { type: 'string' },
|
|
16
|
+
'vitest-dir': { type: 'string' },
|
|
14
17
|
},
|
|
15
18
|
allowPositionals: true,
|
|
16
19
|
});
|
|
@@ -21,6 +24,9 @@ export function parseArgs(argv) {
|
|
|
21
24
|
if (values.out !== undefined) {
|
|
22
25
|
result.out = values.out;
|
|
23
26
|
}
|
|
27
|
+
if (values['vitest-dir'] !== undefined) {
|
|
28
|
+
result.vitestDir = values['vitest-dir'];
|
|
29
|
+
}
|
|
24
30
|
return result;
|
|
25
31
|
}
|
|
26
32
|
//# sourceMappingURL=parse-args.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-args.js","sourceRoot":"","sources":["../../src/mutation/parse-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-args.js","sourceRoot":"","sources":["../../src/mutation/parse-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAYvD;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAC/B,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACjC;QACD,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IAC1B,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -6,6 +6,12 @@ export interface RunStrykerOptions {
|
|
|
6
6
|
* diff-scoped gate). Omitted ⇒ Stryker's configured/default `mutate` set.
|
|
7
7
|
*/
|
|
8
8
|
mutate?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Directory vitest discovers tests in (the vitest runner's `vitest.dir`), relative to the
|
|
11
|
+
* project root — the scan path within the package, so the colocated unit suite alone judges
|
|
12
|
+
* the mutants. Omitted ⇒ vitest's configured/default discovery over the whole project.
|
|
13
|
+
*/
|
|
14
|
+
vitestDir?: string;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Run Stryker over the project in the current working directory via its Node API (#239) and
|
|
@@ -22,6 +22,7 @@ export async function runStryker(options = {}) {
|
|
|
22
22
|
// Results come from runMutationTest()'s return value, so no file/stdout reporter is needed.
|
|
23
23
|
reporters: [],
|
|
24
24
|
...(options.mutate ? { mutate: options.mutate } : {}),
|
|
25
|
+
...(options.vitestDir === undefined ? {} : { vitest: { dir: options.vitestDir } }),
|
|
25
26
|
};
|
|
26
27
|
const results = await new Stryker(cliOptions).runMutationTest();
|
|
27
28
|
const projectRoot = process.cwd();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stryker.js","sourceRoot":"","sources":["../../src/mutation/run-stryker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-stryker.js","sourceRoot":"","sources":["../../src/mutation/run-stryker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AAiBzE,8FAA8F;AAC9F,6FAA6F;AAC7F,6FAA6F;AAC7F,+FAA+F;AAC/F,8FAA8F;AAC9F,MAAM,kBAAkB,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAEpG;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAA6B,EAAE;IAC9D,MAAM,UAAU,GAA0B;QACxC,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE,CAAC,kBAAkB,CAAC;QAC7B,4FAA4F;QAC5F,SAAS,EAAE,EAAE;QACb,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;KACnF,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;SAClD,MAAM,CAAC,CAAC,MAAM,EAA8B,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testing-conventions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Enforce testing conventions in libraries (Python, TypeScript, and Rust).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/testing-conventions",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@testing-conventions/x86_64-unknown-linux-gnu": "0.0.
|
|
47
|
-
"@testing-conventions/aarch64-unknown-linux-gnu": "0.0.
|
|
48
|
-
"@testing-conventions/x86_64-apple-darwin": "0.0.
|
|
49
|
-
"@testing-conventions/aarch64-apple-darwin": "0.0.
|
|
50
|
-
"@testing-conventions/x86_64-pc-windows-msvc": "0.0.
|
|
46
|
+
"@testing-conventions/x86_64-unknown-linux-gnu": "0.0.83",
|
|
47
|
+
"@testing-conventions/aarch64-unknown-linux-gnu": "0.0.83",
|
|
48
|
+
"@testing-conventions/x86_64-apple-darwin": "0.0.83",
|
|
49
|
+
"@testing-conventions/aarch64-apple-darwin": "0.0.83",
|
|
50
|
+
"@testing-conventions/x86_64-pc-windows-msvc": "0.0.83"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@stryker-mutator/api": "^9.6.0",
|