跨任务视角发现的问题:Critical1 materialize.mjs 的 junction 排除比较在 Windows 上因长路径前缀恒假、从未生效,且测试夹具的 junction 指向真源自身, 掩盖了此问题;Critical2 composeSkin 例外通道在 uuid 缺失/框架侧无 meta 时 静默失败,违反第二准则;Important3 可覆盖范围误把 theme/ 下的框架 TS 代码 也纳入;Important5 cli-entry 测试漏注册 check-skin/build-game;Important6 composeSkin 与 check-skin 各自拼路径,未共用 paths.mjs 权威推导;Important7 --platform 缺值时静默落到默认平台。逐条修复并补测试,Critical1 用诱饵框架 目录验证过能真正杀掉该 bug(变异推演见 fix report)。 spec §5 step5 的 dist/<name>/ 拷贝按要求标注为本期未实现,不实现。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
23 lines
912 B
JavaScript
23 lines
912 B
JavaScript
import { test } from 'node:test';
|
||
import assert from 'node:assert/strict';
|
||
import { spawnSync } from 'node:child_process';
|
||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||
import { dirname, join } from 'node:path';
|
||
|
||
const scriptsDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||
const CLI = [
|
||
'setup-links.mjs', 'new-game.mjs', 'check-cocos-version.mjs', 'bump-cocos.mjs',
|
||
'check-skin.mjs', 'build-game.mjs',
|
||
];
|
||
|
||
for (const name of CLI) {
|
||
test(`${name} 被动态 import 时不崩溃(argv[1] undefined)`, () => {
|
||
const url = pathToFileURL(join(scriptsDir, name)).href;
|
||
const r = spawnSync(process.execPath,
|
||
['--input-type=module', '-e', `import(${JSON.stringify(url)}).then(()=>process.exit(0))`],
|
||
{ encoding: 'utf8' });
|
||
assert.equal(r.status, 0, `stderr: ${r.stderr}`);
|
||
assert.ok(!/TypeError/.test(r.stderr), `不应出现 TypeError: ${r.stderr}`);
|
||
});
|
||
}
|