@bushizhanghan/dsh-publish-gate 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -88,7 +88,7 @@ dsh plugin --profile desktop add @bushizhanghan/dsh-publish-gate
88
88
  ## 开发
89
89
 
90
90
  ```sh
91
- node --test test/ # 18 个单测(含 4 个真实插件作 fixture)+ 16 项集成测试
91
+ node --test # 19 个单测(含 4 个真实插件作 fixture)+ 16 项集成测试
92
92
  ```
93
93
 
94
94
  ## License
package/lib/engine.js CHANGED
@@ -499,7 +499,13 @@ export function checkTests(dir) {
499
499
  return null
500
500
  }
501
501
  })()
502
- if (!pkgJson?.scripts?.test) out.push(F('no-test-script', 'info', 'package.json has no "test" script', 'npm test does nothing, so CI and reviewers cannot run your checks.', 'Add "scripts": { "test": "node --test test/" }.'))
502
+ if (!pkgJson?.scripts?.test) out.push(F('no-test-script', 'info', 'package.json has no "test" script', 'npm test does nothing, so CI and reviewers cannot run your checks.', 'Add "scripts": { "test": "node --test" }.'))
503
+ // Node 22+ loads a positional argument to --test as a module path instead of
504
+ // globbing it, so `node --test test/` dies with MODULE_NOT_FOUND on every run
505
+ // while the tests themselves are fine. Auto-discovery needs no argument.
506
+ const testScript = pkgJson?.scripts?.test || ''
507
+ const dirArg = testScript.match(/\bnode\s+--test\s+(?!-)(\S+)/)
508
+ if (dirArg) out.push(F('test-script-dir-arg', 'warn', `test script passes a path to node --test ("${dirArg[1]}")`, 'Node 22+ treats that argument as a module path, not a directory to glob: `node --test test/` throws MODULE_NOT_FOUND, so npm test can never pass even though the tests are fine.', 'Drop the path — "test": "node --test" auto-discovers test/**/*.test.mjs.'))
503
509
  return out
504
510
  }
505
511
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bushizhanghan/dsh-publish-gate",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Helps DSH plugin AUTHORS publish their plugins: a one-command gate that turns every silent failure in the publish path into a deterministic check — package.json completeness, BOM, YAML/JSON parseability, junction and patch insert correctness, npm scope permissions, GitHub repo and token state, market entry format, LICENSE/README, test suite. 帮助插件作者一键发布:写完插件后跑一遍门禁,把发布链路上的每个静默坑变成确定性检查,然后 GitHub + npm + 市场一键三连。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -46,6 +46,6 @@
46
46
  }
47
47
  },
48
48
  "scripts": {
49
- "test": "node --test test/"
49
+ "test": "node --test"
50
50
  }
51
51
  }