Commit c8d1b7b
authored
fix(scripts): the vitest-timeout audit reads a regex literal after an arrow (#3910)
Main's Node tests job fails on `check:vitest-timeout-audit` since #3856: two call sites in `packages/bcf/src/document-reference-guid.test.ts` could not be parsed. The gate asks for the parser to be fixed rather than the file, and that is what this does.
Mechanism: `REGEX_PRECEDING_RE` in `scripts/lib/vitest-timeout-audit.mjs` lacked `>`, and `isRegexStart` inspects only the last significant character, so a `/` right after `=>` was read as division. Line 162 of that test, `const line = (xml: string) => /<DocumentReference Guid="[^"]+"/.exec(xml)![0];`, then opened a phantom string at its first `"` that closed on the next `"` fourteen lines later, blanking an `it` outright and unbalancing the parens of the `describe` and `it` the gate reported.
`>` is added. `<` is deliberately not: in a `.test.tsx` a JSX closing tag puts `/` straight after `<`, and treating that as a regex start parsed a legitimate JSX test to zero call sites. Two regression tests, mutation-checked in both directions: dropping `>` fails only the arrow test, adding `<` fails only the JSX test. Repo-wide listing diff before and after: zero call sites lost, five recovered, only the errors disappear.
Exit codes on the head: `node --test scripts/lib/vitest-timeout-audit.test.mjs` 0 (79 pass), `pnpm run check:vitest-timeout-audit` 0, check-module-size 0 (the module stays at exactly its allowlisted 1165 lines).1 parent c5da727 commit c8d1b7b
2 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
666 | 698 | | |
667 | 699 | | |
668 | 700 | | |
| |||
0 commit comments