@npmcli/template-oss 4.25.1 → 4.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.js CHANGED
@@ -129,6 +129,9 @@ const getFullConfig = async ({
129
129
 
130
130
  const esm = pkg.pkgJson?.type === 'module' || !!pkgConfig.typescript || !!pkgConfig.esm
131
131
 
132
+ // test runner configuration
133
+ const isNodeTest = pkgConfig.testRunner === 'node:test'
134
+
132
135
  // all derived keys
133
136
  const derived = {
134
137
  isRoot,
@@ -168,10 +171,12 @@ const getFullConfig = async ({
168
171
  esm,
169
172
  cjsExt: esm ? 'cjs' : 'js',
170
173
  deleteJsExt: esm ? 'js' : 'cjs',
174
+ // test runner
175
+ isNodeTest,
171
176
  // tap
172
177
  // 18 and up doesn't like nyc-arg
173
- tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major >= 18,
174
- tap16: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
178
+ tap18: !isNodeTest && semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major >= 18,
179
+ tap16: !isNodeTest && semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
175
180
  // booleans to control application of updates
176
181
  isForce,
177
182
  isDogFood,
@@ -202,6 +207,11 @@ const getFullConfig = async ({
202
207
  )
203
208
  }
204
209
 
210
+ // When using node:test, we don't need tap as a dependency
211
+ if (isNodeTest && Array.isArray(pkgConfig.requiredPackages?.devDependencies)) {
212
+ pkgConfig.requiredPackages.devDependencies = pkgConfig.requiredPackages.devDependencies.filter(p => p !== 'tap')
213
+ }
214
+
205
215
  pkgConfig.lintIgnorePaths = [
206
216
  ...(pkgConfig.ignorePaths || []),
207
217
  ...(pkgConfig.lintIgnorePaths || []),
@@ -1,4 +1,15 @@
1
+ {{#unless isNodeTest}}
1
2
  - name: Add Problem Matcher
2
3
  run: echo "::add-matcher::.github/matchers/tap.json"
4
+ {{/unless}}
5
+ {{#if isNodeTest}}
6
+ - name: Test (with coverage on Node >= 24)
7
+ if: $\{{ fromJSON(matrix.node-version) >= 24 }}
8
+ run: {{ rootNpmPath }} run test:cover --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
9
+ - name: Test (without coverage on Node < 24)
10
+ if: $\{{ fromJSON(matrix.node-version) < 24 }}
11
+ run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
12
+ {{else}}
3
13
  - name: Test
4
14
  run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
15
+ {{/if}}
@@ -37,7 +37,10 @@ const sharedRootAdd = name => ({
37
37
  filter: isPublic,
38
38
  },
39
39
  // ci
40
- '.github/matchers/tap.json': 'tap-json.hbs',
40
+ '.github/matchers/tap.json': {
41
+ file: 'tap-json.hbs',
42
+ filter: p => !p.config.isNodeTest,
43
+ },
41
44
  [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci-yml.hbs',
42
45
  // dependabot
43
46
  '.github/dependabot.yml': {
@@ -185,6 +188,7 @@ module.exports = {
185
188
  publish: false,
186
189
  typescript: false,
187
190
  esm: false,
191
+ testRunner: 'tap',
188
192
  updateNpm: true,
189
193
  dependabot: 'increase-if-necessary',
190
194
  dependabotInterval: 'daily',
@@ -17,8 +17,16 @@
17
17
  {{/if}}
18
18
  "postlint": "template-oss-check",
19
19
  "template-oss-apply": "template-oss-apply --force",
20
+ {{#if isNodeTest}}
21
+ "snap": "node --test --test-update-snapshots",
22
+ "test": "node --test --test-timeout=3000",
23
+ "test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100",
24
+ {{else}}
20
25
  "snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
21
26
  "test": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
27
+ "test:cover": {{{ del }}},
28
+ "test:nocover": {{{ del }}},
29
+ {{/if}}
22
30
  "posttest": "{{ localNpmPath }} run lint",
23
31
  {{#if isRootMono}}
24
32
  "test-all": "{{ localNpmPath }} run test {{ allFlags }}",
@@ -40,6 +48,10 @@
40
48
  },
41
49
  "templateVersion": {{{ del }}},
42
50
  "standard": {{{ del }}},
51
+ {{#if isNodeTest}}
52
+ "nyc": {{{ del }}},
53
+ "tap": {{{ del }}}
54
+ {{else}}
43
55
  "nyc": {{#if tap18}}{
44
56
  "exclude": {{{ json workspaceGlobs }}}
45
57
  }{{else}}{{{ del }}}{{/if}},
@@ -78,4 +90,5 @@
78
90
  "tap-snapshots/**"
79
91
  ]{{/if}}
80
92
  }
93
+ {{/if}}
81
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.25.1",
3
+ "version": "4.26.0",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {