mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-22 03:29:18 +01:00
test(ci): wait for watchdog fixture readiness
The worker can create its started marker before the main reporter receives the test-start event. Under CI load the short fixture watchdog then fires in the file-start phase, failing the expected test-name assertion. Wait for both the worker marker and the main reporter event before enabling this test fixture watchdog. Delay the event beyond the fixture stall limit to reproduce the race without depending on host load. Keep the production reporter and every existing deadline and result assertion unchanged. The controlled delay reproduces the failure before the readiness check. All seven reporter tests pass after it, including both real stuck-process cases. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d3d43291e4
commit
36463a770a
1 file changed
+21
-1
@@ -97,7 +97,27 @@ test("passes", () => {});
|
||||
let fixtureReporter = reporterPath;
|
||||
if (label === "a test that never settles") {
|
||||
fixtureReporter = path.join(directory, "after-test-start.mjs");
|
||||
writeFileSync(fixtureReporter, 'import Base from ' + JSON.stringify(pathToFileURL(reporterPath).href) + ';\nimport { existsSync } from "node:fs";\nexport default class extends Base { check() { if (!existsSync(' + JSON.stringify(startedMarker) + ')) return; super.check(); } }\n');
|
||||
writeFileSync(fixtureReporter, `
|
||||
import Base from ${JSON.stringify(pathToFileURL(reporterPath).href)};
|
||||
import { existsSync } from "node:fs";
|
||||
export default class extends Base {
|
||||
ready = false;
|
||||
onTestCaseReady(testCase) {
|
||||
if (testCase.module.moduleId !== ${JSON.stringify(path.join(directory, "stuck.test.mjs"))}) {
|
||||
super.onTestCaseReady(testCase);
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
super.onTestCaseReady(testCase);
|
||||
this.ready = true;
|
||||
}, this.limitMs + 500);
|
||||
}
|
||||
check() {
|
||||
if (!this.ready || !existsSync(${JSON.stringify(startedMarker)})) return;
|
||||
super.check();
|
||||
}
|
||||
}
|
||||
`);
|
||||
}
|
||||
const configFile = path.join(directory, "vitest.config.mjs");
|
||||
writeFileSync(configFile, `export default ${JSON.stringify({ test: { include: ["*.test.mjs"],
|
||||
|
||||
Reference in new issue
Block a user