Skip to content

Commit 5523dda

Browse files
test: scope parallel workflow policy
1 parent be88735 commit 5523dda

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/scripts/workflow-policy.test.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ const workflowFiles = async () => {
3535
return entries.filter((entry) => entry.isFile() && /\.ya?ml$/.test(entry.name));
3636
};
3737

38+
const workflowJob = (workflow, jobName) => {
39+
const marker = ` ${jobName}:\n`;
40+
const start = workflow.indexOf(marker);
41+
assert.notEqual(start, -1, `missing ${jobName} job`);
42+
43+
const bodyStart = start + marker.length;
44+
const remaining = workflow.slice(bodyStart);
45+
const nextJob = remaining.search(/^ [\w-]+:/m);
46+
return nextJob === -1 ? remaining : remaining.slice(0, nextJob);
47+
};
48+
3849
describe("JavaScript dependency policy", () => {
3950
it("keeps pnpm-lock.yaml as the only tracked JavaScript lockfile", async () => {
4051
assert.deepEqual(await trackedPackageLocks(), []);
@@ -58,8 +69,10 @@ describe("JavaScript dependency policy", () => {
5869
describe("Rust feature coverage", () => {
5970
it("tests both parallel encoders in Linux CI", async () => {
6071
const workflow = await readFile(CI_WORKFLOW_URL, "utf8");
72+
const job = workflowJob(workflow, "parallel-features");
6173

62-
assert.match(workflow, /cargo test -p srcmap-codec --features parallel\b/);
63-
assert.match(workflow, /cargo test -p srcmap-generator --features parallel\b/);
74+
assert.match(job, /^ runs-on: ubuntu-latest$/m);
75+
assert.match(job, /^ run: cargo test -p srcmap-codec --features parallel$/m);
76+
assert.match(job, /^ run: cargo test -p srcmap-generator --features parallel$/m);
6477
});
6578
});

0 commit comments

Comments
 (0)