Skip to content

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

test(module-test-runner): deduplicate module-gated test inventory

Steven Enamakel4137b2ea5531
diff --git a/scripts/__tests__/module-test-runner.test.mjs b/scripts/__tests__/module-test-runner.test.mjs
index 2cef1fd113..c66df6ef4a 100644
--- a/scripts/__tests__/module-test-runner.test.mjs
+++ b/scripts/__tests__/module-test-runner.test.mjs
@@ -60,6 +60,19 @@ test("rejects a vacuous ignored-test inventory", () => {
assert.match(result.stderr, /inventory is empty/);
});
+test("module-gated source inventory contains unique sorted names", () => {
+ const inventory = spawnSync(
+ "node",
+ [path.join(repoRoot, "scripts", "ci", "list-module-gated-tests.mjs"), "--json"],
+ { cwd: repoRoot, encoding: "utf8" },
+ );
+
+ assert.equal(inventory.status, 0, inventory.stderr);
+ const { run, skipped } = JSON.parse(inventory.stdout);
+ assert.deepEqual(run, [...new Set(run)].sort());
+ assert.deepEqual(skipped, [...new Set(skipped)].sort());
+});
+
test("fails when the skipped-test inventory command fails", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "openhuman-module-tests-skipped-failure-"));
const bin = path.join(root, "bin");
diff --git a/scripts/ci/list-module-gated-tests.mjs b/scripts/ci/list-module-gated-tests.mjs
index 1990748292..ff2b1873a6 100755
--- a/scripts/ci/list-module-gated-tests.mjs
+++ b/scripts/ci/list-module-gated-tests.mjs
@@ -30,7 +30,10 @@ function scan(file) {
}
visit(sourceRoot);
-const result = { run: run.sort(), skipped: skipped.sort() };
+const result = {
+ run: [...new Set(run)].sort(),
+ skipped: [...new Set(skipped)].sort(),
+};
if (process.argv.includes("--json")) console.log(JSON.stringify(result));
else if (process.argv.includes("--skipped")) console.log(result.skipped.join("\n"));