diff --git a/scripts/run-wp6-04-validation.mjs b/scripts/run-wp6-04-validation.mjs index 38e7579..c70cc5d 100644 --- a/scripts/run-wp6-04-validation.mjs +++ b/scripts/run-wp6-04-validation.mjs @@ -1,7 +1,8 @@ import { createHash } from "node:crypto"; import { spawnSync } from "node:child_process"; import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"; -import { resolve } from "node:path"; +import { homedir } from "node:os"; +import { join, resolve } from "node:path"; const phaseIndex = process.argv.indexOf("--phase"); const phase = phaseIndex >= 0 ? process.argv[phaseIndex + 1] : "green"; @@ -10,6 +11,7 @@ if (!new Set(["red", "green"]).has(phase)) throw new Error(`Unsupported phase: $ const runId = process.env.DADA_TDD_RUN_ID ?? `wp6-04-${phase}-${new Date().toISOString().replace(/[^0-9]/g, "")}`; const runDirectory = resolve("artifacts", "tdd", runId); const caseDirectory = resolve(runDirectory, "cases", "TDD-WP6-AUD-001-sensitive-operations"); +const replicationRoot = resolve(process.env.DADA_REPLICATION_ASSET_ROOT ?? join(homedir(), "Desktop", "sticker_web_replication_assets")); if (existsSync(runDirectory)) throw new Error(`Evidence run already exists: ${runId}`); mkdirSync(caseDirectory, { recursive: true }); @@ -17,6 +19,9 @@ const environment = { ...process.env, DADA_EVIDENCE_DIR_WP6_AUD: caseDirectory, DADA_PLAYWRIGHT_OUTPUT_DIR: resolve(runDirectory, "playwright-output"), + DADA_STATIC_STICKER_ROOT: process.env.DADA_STATIC_STICKER_ROOT ?? join(replicationRoot, "sticker_normal"), + DADA_DYNAMIC_ASSET_ROOT: process.env.DADA_DYNAMIC_ASSET_ROOT ?? join(replicationRoot, "sticker_interactive", "单模板归档", "templates"), + DADA_TEXT_ASSET_ROOT: process.env.DADA_TEXT_ASSET_ROOT ?? join(replicationRoot, "sticker_text"), }; const commands = phase === "red" ? [ @@ -25,8 +30,8 @@ const commands = phase === "red" ["e2e-red", ".\\node_modules\\.bin\\playwright.CMD test tests/e2e/wp6-04-audit.spec.ts --config playwright.config.ts"], ] : [ - ["integration", "pnpm.cmd test:integration"], - ["api", "pnpm.cmd test:api"], + ["integration", "pnpm.cmd exec vitest run tests/integration --testTimeout=20000"], + ["api", "pnpm.cmd check:openapi && pnpm.cmd exec vitest run tests/api --testTimeout=20000"], ["worker", "pnpm.cmd test:worker"], ["e2e", "pnpm.cmd test:e2e"], ["tdd-trace", "pnpm.cmd validate:tdd-trace"],