Skip to content

Commit eeb4266

Browse files
authored
fix: uses ci-friendly startsWith instead of fromJSON (#531)
1 parent 79e95de commit eeb4266

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lib/content/_step-test-yml.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
{{/unless}}
55
{{#if isNodeTest}}
66
- name: Test (with coverage on Node >= 24)
7-
if: $\{{ fromJSON(matrix.node-version) >= 24 }}
7+
if: $\{{ startsWith(matrix.node-version, '24') }}
88
run: {{ rootNpmPath }} run test:cover --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
99
- name: Test (without coverage on Node < 24)
10-
if: $\{{ fromJSON(matrix.node-version) < 24 }}
10+
if: $\{{ !startsWith(matrix.node-version, '24') }}
1111
run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
1212
{{else}}
1313
- name: Test

lib/content/package-json.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"template-oss-apply": "template-oss-apply --force",
2020
{{#if isNodeTest}}
2121
"snap": "node --test --test-update-snapshots",
22-
"test": "node --test --test-timeout=3000",
22+
"test": "node --test",
2323
"test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100",
2424
{{else}}
2525
"snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",

test/apply/node-test-ci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ t.test('CI workflow with node:test does not include tap matcher', async t => {
2121
// Verify conditional test steps for coverage
2222
t.match(ciWorkflow, /Test \(with coverage on Node >= 24\)/, 'should have test with coverage step for Node >= 24')
2323
t.match(ciWorkflow, /Test \(without coverage on Node < 24\)/, 'should have test without coverage step for Node < 24')
24-
t.match(ciWorkflow, 'fromJSON(matrix.node-version) >= 24', 'should check if Node version >= 24')
25-
t.match(ciWorkflow, 'fromJSON(matrix.node-version) < 24', 'should check if Node version < 24')
24+
t.match(ciWorkflow, "startsWith(matrix.node-version, '24')", 'should check if Node version starts with 24')
25+
t.match(ciWorkflow, "!startsWith(matrix.node-version, '24')", 'should check if Node version does not start with 24')
2626
t.match(ciWorkflow, /test:cover/, 'should use test:cover script for Node >= 24')
2727
})
2828

test/apply/node-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ t.test('node:test runner', async t => {
1515
const pkg = await s.readJson('package.json')
1616

1717
// Verify test scripts are for node:test
18-
t.equal(pkg.scripts.test, 'node --test --test-timeout=3000')
18+
t.equal(pkg.scripts.test, 'node --test')
1919
t.equal(
2020
pkg.scripts['test:cover'],
2121
'node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100',

0 commit comments

Comments
 (0)