Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(ci): run browser test skip check in scripts lane

Steven Enamakele5a1ba18b28f
diff --git a/scripts/__tests__/browser-test-skips.test.mjs b/scripts/__tests__/browser-test-skips.test.mjs
new file mode 100644
index 0000000000..5e6b6eba0b
--- /dev/null
+++ b/scripts/__tests__/browser-test-skips.test.mjs
@@ -0,0 +1,19 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { untrackedSkipLines } from "../ci/check-browser-test-skips.mjs";
+
+test("browser skip guard requires an issue URL on the added skip line", () => {
+ const patch = [
+ "+ test.skip('tracked', async () => {}); // https://github.com/tinyhumansai/openhuman/issues/123",
+ "+ it.skip('missing link', () => {}); // see issue #456",
+ "+ describe.skip('also missing', () => {});",
+ "+// test.skip('comment, not executable');",
+ "- test.skip('removed', () => {});",
+ ].join("\n");
+
+ assert.deepEqual(untrackedSkipLines(patch), [
+ " it.skip('missing link', () => {}); // see issue #456",
+ " describe.skip('also missing', () => {});",
+ ]);
+});
diff --git a/scripts/ci/check-browser-test-skips.mjs b/scripts/ci/check-browser-test-skips.mjs
new file mode 100644
index 0000000000..4972904686
--- /dev/null
+++ b/scripts/ci/check-browser-test-skips.mjs
@@ -0,0 +1,38 @@
+#!/usr/bin/env node
+// New browser-test skips must carry the tracking issue on the skip line.
+// Existing skips are audited separately; this prevents the inventory growing
+// without requiring a one-time, potentially misleading mass annotation.
+
+import { execFileSync } from "node:child_process";
+
+export function untrackedSkipLines(patch) {
+ const failures = [];
+ for (const line of patch.split("\n")) {
+ if (!line.startsWith("+") || line.startsWith("+++")) continue;
+ const source = line.slice(1);
+ if (/^\s*\/\//.test(source)) continue;
+ if (!/\b(?:it|test|describe)\.skip\s*\(/.test(source)) continue;
+ if (!/https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/issues\/\d+/.test(source)) {
+ failures.push(source.trim());
+ }
+ }
+ return failures;
+}
+
+if (process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href) {
+ const base = process.env.GITHUB_BASE_REF
+ ? `origin/${process.env.GITHUB_BASE_REF}`
+ : "origin/main";
+ let patch;
+ try {
+ patch = execFileSync("git", ["diff", "--unified=0", `${base}...HEAD", "--", "app/test/e2e/specs", "app/test/playwright/specs"], { encoding: "utf8" });
+ } catch (error) {
+ console.error(`Could not compare browser-test skips with ${base}: ${error.message}`);
+ process.exit(2);
+ }
+ const failures = untrackedSkipLines(patch);
+ if (failures.length) {
+ console.error("New browser-test skips need a GitHub issue URL on the same line:\n" + failures.map((line) => ` ${line}`).join("\n"));
+ process.exit(1);
+ }
+}
diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs
index d30dae928a..b7f33372a7 100644
--- a/scripts/ci/self-hosted/lanes-plan.mjs
+++ b/scripts/ci/self-hosted/lanes-plan.mjs
@@ -354,7 +354,7 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
name: "scripts-self-tests",
when: areas.scripts,
needs: ["pnpm-install"],
- run: "pnpm test:scripts",
+ run: "pnpm test:scripts && node scripts/ci/check-browser-test-skips.mjs",
},
],
},