Skip to content

Commit 579d3ca

Browse files
rockyshi1993Copilot
andcommitted
test: integrate v1-compat-runner into npm test (2714 total tests)
- Add v1 compat runner as 5th suite in run-all-tests.cjs - Parse last match for summary stats (avoid per-file line collision) - npm test now shows: 176 unit/integration + 2538 v1 compat = 2714 total Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent edcf324 commit 579d3ca

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

scripts/run-all-tests.cjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,35 @@ function runSuite(label, files) {
100100
return { ...stats, exitCode: result.status ?? 1 };
101101
}
102102

103+
// ─── v1 Compat Runner (separate process, custom output format) ────────────────
104+
105+
function runV1Compat() {
106+
banner('v1 Compatibility Tests (2500+ cases)');
107+
const result = spawnSync(process.execPath, [
108+
path.join(__dirname, 'v1-compat-runner.cjs'),
109+
'all-v2',
110+
], {
111+
cwd: ROOT,
112+
stdio: ['inherit', 'pipe', 'pipe'],
113+
encoding: 'utf8',
114+
});
115+
116+
if (result.stdout) process.stdout.write(result.stdout);
117+
if (result.stderr) process.stderr.write(result.stderr);
118+
119+
const out = result.stdout || '';
120+
let pass = 0, fail = 0, skip = 0;
121+
122+
// Use last match (per-file lines also have same pattern; summary is last)
123+
const passMatches = [...out.matchAll(/[:]\s*(\d+)/g)];
124+
const failMatches = [...out.matchAll(/[:]\s*(\d+)/g)];
125+
const skipMatches = [...out.matchAll(/[:]\s*(\d+)/g)];
126+
if (passMatches.length) pass = parseInt(passMatches[passMatches.length - 1][1], 10);
127+
if (failMatches.length) fail = parseInt(failMatches[failMatches.length - 1][1], 10);
128+
if (skipMatches.length) skip = parseInt(skipMatches[skipMatches.length - 1][1], 10);
129+
return { pass, fail, skip, exitCode: result.status ?? 1 };
130+
}
131+
103132
// ─── Main ─────────────────────────────────────────────────────────────────────
104133

105134
const suites = [
@@ -124,6 +153,15 @@ for (const { label, files } of suites) {
124153
}
125154
}
126155

156+
// Run v1 compat tests last (long-running)
157+
const v1Stats = runV1Compat();
158+
totalPass += v1Stats.pass;
159+
totalFail += v1Stats.fail;
160+
totalSkip += v1Stats.skip;
161+
if (v1Stats.fail > 0) {
162+
anyFailed = true;
163+
}
164+
127165
const total = totalPass + totalFail + totalSkip;
128166
const line = '─'.repeat(65);
129167

0 commit comments

Comments
 (0)