Commit c994516d05edc430b7e295e768c54711b2da311d

Authored by zichun
1 parent c2d4c16b

test.mjs: drop redundant trailing reset-test-db (6/5 -> 5 stages)

尾部 6/6 reset-test-db 与下次运行的 1/x setup-test-db 重复(都 DROP+CREATE),对正确性零贡献;删除后闸门为 detect→setup→build→lint→test→e2e,重编号 1/5..5/5。
skills/plan/skeleton-gen/templates/scripts-test-template.mjs
1 1 #!/usr/bin/env node
2 2 // scripts/test.mjs —— 合并到默认分支(main / master)前的测试闸门。
3   -// 顺序:detect → setup-db → build → lint → unit+integration → e2e → reset-db
  3 +// 顺序:detect → setup-db → build → lint → unit+integration → e2e
  4 +// (不在尾部 reset:下次跑的 setup-db 会 DROP+CREATE,重复清库无意义)
4 5 // 由 coding.mjs 的 test-gate stage(通过子会话)调用。
5 6 //
6 7 // 跨平台:所有命令经 child_process.spawnSync(cmd, { shell:true }) 执行,
... ... @@ -39,31 +40,28 @@ if (!hasBackend && !hasFrontend) {
39 40 const backendDir = join(PROJECT_ROOT, 'backend')
40 41 const frontendDir = join(PROJECT_ROOT, 'frontend')
41 42  
42   -console.log('[test.mjs] 1/6 setup test db')
  43 +console.log('[test.mjs] 1/5 setup test db')
43 44 run('setup-test-db', `node ${JSON.stringify(join('scripts', 'setup-test-db.mjs'))}`)
44 45  
45   -console.log('[test.mjs] 2/6 build')
  46 +console.log('[test.mjs] 2/5 build')
46 47 if (hasBackend) run('backend build', '{{backend_build}}', backendDir)
47 48 else console.log('[test.mjs] skip backend build')
48 49 if (hasFrontend) run('frontend build', '{{frontend_build}}', frontendDir)
49 50 else console.log('[test.mjs] skip frontend build')
50 51  
51   -console.log('[test.mjs] 3/6 lint')
  52 +console.log('[test.mjs] 3/5 lint')
52 53 if (hasBackend) run('backend lint', '{{backend_lint}}', backendDir)
53 54 else console.log('[test.mjs] skip backend lint')
54 55 if (hasFrontend) run('frontend lint', '{{frontend_lint}}', frontendDir)
55 56 else console.log('[test.mjs] skip frontend lint')
56 57  
57   -console.log('[test.mjs] 4/6 unit + integration')
  58 +console.log('[test.mjs] 4/5 unit + integration')
58 59 if (hasBackend) run('backend test', '{{backend_test}}', backendDir)
59 60 else console.log('[test.mjs] skip backend test')
60 61 if (hasFrontend) run('frontend test', '{{frontend_test}}', frontendDir)
61 62 else console.log('[test.mjs] skip frontend test')
62 63  
63   -console.log('[test.mjs] 5/6 E2E')
  64 +console.log('[test.mjs] 5/5 E2E')
64 65 run('e2e', '{{e2e_cmd}}')
65 66  
66   -console.log('[test.mjs] 6/6 reset test db')
67   -run('reset-test-db', `node ${JSON.stringify(join('scripts', 'setup-test-db.mjs'))}`)
68   -
69 67 console.log('[test.mjs] GREEN')
... ...