界面迁移更新
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
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}`);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user