@@ -3,12 +3,14 @@ import test from 'node:test'
33
44import { findProblems , parseJobIds } from './check-ci-gates.js'
55
6- const workflow = ( jobIds , { node = '26.1.0' , pnpm = '10.11.1' } = { } ) =>
6+ // Versions below are arbitrary fixtures, not the repo's real pins — the guard
7+ // reads those from dev.yml / tests-pr.yml at runtime, never hard-coded.
8+ const workflow = ( jobIds , { node = '1.2.3' , pnpm = '4.5.6' } = { } ) =>
79 `name: tests\non: pull_request\nenv:\n DEFAULT_NODE_VERSION: '${ node } '\n PNPM_VERSION: '${ pnpm } '\njobs:\n` +
810 jobIds . map ( ( id ) => ` ${ id } :\n runs-on: ubuntu-latest\n steps: []` ) . join ( '\n' ) +
911 '\n'
1012
11- const devYml = ( { node = '26.1.0 ' , pnpm = '10.11.1 ' } = { } ) =>
13+ const devYml = ( { node = '1.2.3 ' , pnpm = '4.5.6 ' } = { } ) =>
1214 `name: cli\nup:\n - node:\n version: ${ node } \n package_manager: pnpm@${ pnpm } \n - packages:\n - jq\n`
1315
1416test ( 'in sync: no problems' , ( ) => {
@@ -27,7 +29,7 @@ test('manifest lists a job absent from the workflow', () => {
2729} )
2830
2931test ( 'node version mismatch is detected' , ( ) => {
30- const { problems} = findProblems ( { workflow : workflow ( [ 'a' ] , { node : '25.0.0 ' } ) , devYml : devYml ( { node : '26.1.0 ' } ) , manifestJobIds : [ 'a' ] } )
32+ const { problems} = findProblems ( { workflow : workflow ( [ 'a' ] , { node : '9.9.9 ' } ) , devYml : devYml ( { node : '1.2.3 ' } ) , manifestJobIds : [ 'a' ] } )
3133 assert . match ( problems . join ( '\n' ) , / N o d e v e r s i o n m i s m a t c h / )
3234} )
3335
@@ -45,7 +47,7 @@ test('a missing version pin is reported, not silently passed', () => {
4547// Hardening: tolerate a trailing comment after the job id, and ignore deeper-indented
4648// keys, blank lines, comment lines, and any top-level section after `jobs:`.
4749test ( 'parseJobIds tolerates comments and ignores non-job lines' , ( ) => {
48- const wf = `env:\n DEFAULT_NODE_VERSION: '26.1.0 '\njobs:\n build: # freshness gate\n runs-on: ubuntu-latest\n env:\n NESTED: 1\n\n # a comment line\n test-job:\n steps: []\nconcurrency:\n group: x\n`
50+ const wf = `env:\n DEFAULT_NODE_VERSION: '1.2.3 '\njobs:\n build: # freshness gate\n runs-on: ubuntu-latest\n env:\n NESTED: 1\n\n # a comment line\n test-job:\n steps: []\nconcurrency:\n group: x\n`
4951 assert . deepEqual ( parseJobIds ( wf ) , [ 'build' , 'test-job' ] )
5052} )
5153
0 commit comments