diff --git a/lib/content/_step-test-yml.hbs b/lib/content/_step-test-yml.hbs index d860fbf3..a767fb9a 100644 --- a/lib/content/_step-test-yml.hbs +++ b/lib/content/_step-test-yml.hbs @@ -4,10 +4,10 @@ {{/unless}} {{#if isNodeTest}} - name: Test (with coverage on Node >= 24) - if: $\{{ fromJSON(matrix.node-version) >= 24 }} + if: $\{{ startsWith(matrix.node-version, '24') }} run: {{ rootNpmPath }} run test:cover --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}} - name: Test (without coverage on Node < 24) - if: $\{{ fromJSON(matrix.node-version) < 24 }} + if: $\{{ !startsWith(matrix.node-version, '24') }} run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}} {{else}} - name: Test diff --git a/lib/content/package-json.hbs b/lib/content/package-json.hbs index 98bc7b8e..73f288b4 100644 --- a/lib/content/package-json.hbs +++ b/lib/content/package-json.hbs @@ -19,7 +19,7 @@ "template-oss-apply": "template-oss-apply --force", {{#if isNodeTest}} "snap": "node --test --test-update-snapshots", - "test": "node --test --test-timeout=3000", + "test": "node --test", "test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100", {{else}} "snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap", diff --git a/test/apply/node-test-ci.js b/test/apply/node-test-ci.js index 6a1d6282..6963fe66 100644 --- a/test/apply/node-test-ci.js +++ b/test/apply/node-test-ci.js @@ -21,8 +21,8 @@ t.test('CI workflow with node:test does not include tap matcher', async t => { // Verify conditional test steps for coverage t.match(ciWorkflow, /Test \(with coverage on Node >= 24\)/, 'should have test with coverage step for Node >= 24') t.match(ciWorkflow, /Test \(without coverage on Node < 24\)/, 'should have test without coverage step for Node < 24') - t.match(ciWorkflow, 'fromJSON(matrix.node-version) >= 24', 'should check if Node version >= 24') - t.match(ciWorkflow, 'fromJSON(matrix.node-version) < 24', 'should check if Node version < 24') + t.match(ciWorkflow, "startsWith(matrix.node-version, '24')", 'should check if Node version starts with 24') + t.match(ciWorkflow, "!startsWith(matrix.node-version, '24')", 'should check if Node version does not start with 24') t.match(ciWorkflow, /test:cover/, 'should use test:cover script for Node >= 24') }) diff --git a/test/apply/node-test.js b/test/apply/node-test.js index 42bd92f5..3cef036a 100644 --- a/test/apply/node-test.js +++ b/test/apply/node-test.js @@ -15,7 +15,7 @@ t.test('node:test runner', async t => { const pkg = await s.readJson('package.json') // Verify test scripts are for node:test - t.equal(pkg.scripts.test, 'node --test --test-timeout=3000') + t.equal(pkg.scripts.test, 'node --test') t.equal( pkg.scripts['test:cover'], 'node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100',