diff --git a/skills/plan/skeleton-gen/templates/scripts-test-template.mjs b/skills/plan/skeleton-gen/templates/scripts-test-template.mjs index 9f0ab8c..ccccaa6 100644 --- a/skills/plan/skeleton-gen/templates/scripts-test-template.mjs +++ b/skills/plan/skeleton-gen/templates/scripts-test-template.mjs @@ -1,6 +1,7 @@ #!/usr/bin/env node // scripts/test.mjs —— 合并到默认分支(main / master)前的测试闸门。 -// 顺序:detect → setup-db → build → lint → unit+integration → e2e → reset-db +// 顺序:detect → setup-db → build → lint → unit+integration → e2e +// (不在尾部 reset:下次跑的 setup-db 会 DROP+CREATE,重复清库无意义) // 由 coding.mjs 的 test-gate stage(通过子会话)调用。 // // 跨平台:所有命令经 child_process.spawnSync(cmd, { shell:true }) 执行, @@ -39,31 +40,28 @@ if (!hasBackend && !hasFrontend) { const backendDir = join(PROJECT_ROOT, 'backend') const frontendDir = join(PROJECT_ROOT, 'frontend') -console.log('[test.mjs] 1/6 setup test db') +console.log('[test.mjs] 1/5 setup test db') run('setup-test-db', `node ${JSON.stringify(join('scripts', 'setup-test-db.mjs'))}`) -console.log('[test.mjs] 2/6 build') +console.log('[test.mjs] 2/5 build') if (hasBackend) run('backend build', '{{backend_build}}', backendDir) else console.log('[test.mjs] skip backend build') if (hasFrontend) run('frontend build', '{{frontend_build}}', frontendDir) else console.log('[test.mjs] skip frontend build') -console.log('[test.mjs] 3/6 lint') +console.log('[test.mjs] 3/5 lint') if (hasBackend) run('backend lint', '{{backend_lint}}', backendDir) else console.log('[test.mjs] skip backend lint') if (hasFrontend) run('frontend lint', '{{frontend_lint}}', frontendDir) else console.log('[test.mjs] skip frontend lint') -console.log('[test.mjs] 4/6 unit + integration') +console.log('[test.mjs] 4/5 unit + integration') if (hasBackend) run('backend test', '{{backend_test}}', backendDir) else console.log('[test.mjs] skip backend test') if (hasFrontend) run('frontend test', '{{frontend_test}}', frontendDir) else console.log('[test.mjs] skip frontend test') -console.log('[test.mjs] 5/6 E2E') +console.log('[test.mjs] 5/5 E2E') run('e2e', '{{e2e_cmd}}') -console.log('[test.mjs] 6/6 reset test db') -run('reset-test-db', `node ${JSON.stringify(join('scripts', 'setup-test-db.mjs'))}`) - console.log('[test.mjs] GREEN')