|
1 | 1 | import assert from 'node:assert/strict' |
2 | 2 | import test from 'node:test' |
3 | | -import { mkdtempSync, readFileSync, writeFileSync, rmSync, symlinkSync } from 'node:fs' |
| 3 | +import { mkdirSync, mkdtempSync, writeFileSync, rmSync, symlinkSync } from 'node:fs' |
4 | 4 | import { tmpdir } from 'node:os' |
5 | 5 | import { join } from 'node:path' |
6 | 6 | import { |
| 7 | + actionlintEligibleWorkflows, |
7 | 8 | digest, |
8 | 9 | FIXTURES, |
9 | 10 | localizeCalls, |
@@ -67,19 +68,32 @@ test('candidate source identity is mandatory before any install', () => { |
67 | 68 | ) |
68 | 69 | }) |
69 | 70 |
|
70 | | -test('the actionlint pass excludes pending parallel syntax by content, not by filename', () => { |
71 | | - // actionlint v1.7.12 predates the step-parallelism keywords; the |
72 | | - // qualification skips any workflow whose text uses them so |
73 | | - // repository-owned adopters (adea's desktop-shell) stay covered without |
74 | | - // list maintenance. |
75 | | - const source = readFileSync(join(process.cwd(), 'src/lib/consumer-qualification.mjs'), 'utf8') |
76 | | - const line = source |
77 | | - .split('\n') |
78 | | - .find((candidate) => candidate.includes('const pendingParallelSyntax =')) |
79 | | - assert.ok(line, 'the qualification declares the pending-syntax pattern') |
80 | | - for (const keyword of ['background', 'wait', 'wait-all', 'cancel', 'parallel']) { |
81 | | - assert.ok(line.includes(keyword), `the pattern covers ${keyword}`) |
| 71 | +test('the actionlint pass filters pending parallel syntax by content, not filename', (t) => { |
| 72 | + const workflows = join(temporary(t), '.github', 'workflows') |
| 73 | + mkdirSync(workflows, { recursive: true }) |
| 74 | + const keywords = ['background', 'wait', 'wait-all', 'cancel', 'parallel'] |
| 75 | + for (const keyword of keywords) { |
| 76 | + writeFileSync( |
| 77 | + join(workflows, `pending-sequence-${keyword}.yml`), |
| 78 | + `jobs:\n check:\n steps:\n - ${keyword}:\n run: echo pending\n` |
| 79 | + ) |
| 80 | + writeFileSync( |
| 81 | + join(workflows, `pending-mapping-${keyword}.yaml`), |
| 82 | + `workflow:\n ${keyword}:\n enabled: true\n` |
| 83 | + ) |
82 | 84 | } |
83 | | - assert.ok(!source.includes("new Set(['validation-billing.yml'])"), 'the filename list is gone') |
84 | | - assert.match(source, /pendingParallelSyntax\.test\(text\)/, 'files are filtered by content') |
| 85 | + writeFileSync( |
| 86 | + join(workflows, 'validation-billing.yml'), |
| 87 | + 'jobs:\n check:\n steps:\n - run: echo parallel\n' |
| 88 | + ) |
| 89 | + writeFileSync( |
| 90 | + join(workflows, 'validation.yml'), |
| 91 | + 'jobs:\n check:\n steps:\n - run: echo ok\n' |
| 92 | + ) |
| 93 | + writeFileSync(join(workflows, 'README.md'), 'parallel:\n') |
| 94 | + |
| 95 | + assert.deepEqual(actionlintEligibleWorkflows(workflows).toSorted(), [ |
| 96 | + 'validation-billing.yml', |
| 97 | + 'validation.yml', |
| 98 | + ]) |
85 | 99 | }) |
0 commit comments