23 lines
1000 B
JavaScript
23 lines
1000 B
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
const root = process.cwd();
|
|
|
|
test('package.json exposes the canonical gate:verify command', async () => {
|
|
const packageJson = JSON.parse(await readFile(`${root}/package.json`, 'utf8'));
|
|
assert.equal(packageJson.scripts['gate:verify'], 'node scripts/gate-verify.mjs');
|
|
});
|
|
|
|
test('Woodpecker runs gate verification on every pipeline without a path filter', async () => {
|
|
const pipeline = await readFile(`${root}/.woodpecker/ci.yml`, 'utf8');
|
|
assert.match(pipeline, /\n gate-verify:\n/);
|
|
const step =
|
|
pipeline.match(/\n gate-verify:\n([\s\S]*?)(?=\n [a-z][a-z0-9-]+:|\nservices:)/)?.[1] ?? '';
|
|
assert.match(
|
|
step,
|
|
/commands:\n - \*enable_pnpm\n - apk add --no-cache bubblewrap\n - if \[ -f \.git\/shallow \]; then git fetch --unshallow --no-tags origin; fi\n - pnpm gate:verify\n/,
|
|
);
|
|
assert.doesNotMatch(step, /\bwhen:|\bpath:/);
|
|
});
|