@jwilger/pi-development-system 0.10.5 → 0.10.6
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/package.json
CHANGED
package/src/core/test-runner.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type ResultLike = {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/** A pipe or sequence makes the shell report the last command's status, not the runner's. */
|
|
62
|
-
const MASKS_STATUS =
|
|
62
|
+
const MASKS_STATUS = /[|;\n]/;
|
|
63
63
|
const FAILURE_MARKERS =
|
|
64
64
|
/^(?:# |ℹ )fail [1-9]|test result: FAILED|\b[1-9]\d* (?:failed|failing)\b|^FAILED\b|^FAIL\b|\bnot ok\b/m;
|
|
65
65
|
|
|
@@ -15,6 +15,8 @@ const GATE_ID = "tdd.red-first";
|
|
|
15
15
|
/** Test code written inside a source file (Rust `#[cfg(test)]`/`#[test]`): that edit is the RED step itself. */
|
|
16
16
|
const INLINE_TEST = /#\[(?:cfg\(test\)|test|test_case|rstest|proptest|\w+::test)\b/g;
|
|
17
17
|
|
|
18
|
+
const INLINE_MODULE = /#\[cfg\(test\)\]\s*(?:#\[[^\]]*\]\s*)*mod\s+\w+\s*\{/;
|
|
19
|
+
|
|
18
20
|
const countInlineTests = (text: string): number => text.match(INLINE_TEST)?.length ?? 0;
|
|
19
21
|
|
|
20
22
|
const existing = (cwd: string, path: string): string => {
|
|
@@ -31,7 +33,8 @@ type EditInput =
|
|
|
31
33
|
|
|
32
34
|
/** Is every edit inside the file's existing `#[cfg(test)]` module? Changing a test's expectation is RED itself. */
|
|
33
35
|
const insideTestModule = (edits: ReadonlyArray<{ oldText: string }>, file: string): boolean => {
|
|
34
|
-
|
|
36
|
+
// Only an inline module body counts: `mod tests;`, `#[cfg(test)] use ...` and fns are not test code.
|
|
37
|
+
const start = INLINE_MODULE.exec(file)?.index ?? -1;
|
|
35
38
|
return start >= 0 && edits.every((e) => e.oldText !== "" && file.indexOf(e.oldText) > start);
|
|
36
39
|
};
|
|
37
40
|
|