新建项目
This commit is contained in:
38
tests/release-readiness.test.js
Normal file
38
tests/release-readiness.test.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const projectRoot = path.join(__dirname, "..");
|
||||
const appConfig = JSON.parse(fs.readFileSync(path.join(projectRoot, "app.json"), "utf8"));
|
||||
const projectConfig = JSON.parse(
|
||||
fs.readFileSync(path.join(projectRoot, "project.config.json"), "utf8")
|
||||
);
|
||||
|
||||
assert.strictEqual(projectConfig.compileType, "miniprogram");
|
||||
assert.ok(Array.isArray(appConfig.pages) && appConfig.pages.length > 0);
|
||||
assert.strictEqual(new Set(appConfig.pages).size, appConfig.pages.length, "app pages must be unique");
|
||||
|
||||
appConfig.pages.forEach((pagePath) => {
|
||||
["js", "json", "wxml", "wxss"].forEach((extension) => {
|
||||
const file = path.join(projectRoot, `${pagePath}.${extension}`);
|
||||
assert.ok(fs.existsSync(file), `missing page file: ${pagePath}.${extension}`);
|
||||
});
|
||||
});
|
||||
|
||||
[
|
||||
"README.md",
|
||||
"docs/PRD.md",
|
||||
"docs/TECHNICAL_DESIGN.md",
|
||||
"docs/ONE_WEEK_MVP_PLAN.md",
|
||||
"docs/DEVICE_TEST_CHECKLIST.md",
|
||||
"docs/DEMO_GUIDE.md",
|
||||
"docs/TEST_REPORT.md",
|
||||
"docs/RELEASE_NOTES.md"
|
||||
].forEach((relativePath) => {
|
||||
assert.ok(fs.existsSync(path.join(projectRoot, relativePath)), `missing deliverable: ${relativePath}`);
|
||||
});
|
||||
|
||||
const appSource = fs.readFileSync(path.join(projectRoot, "app.js"), "utf8");
|
||||
assert.match(appSource, /version:\s*"0\.1\.0-mvp"/);
|
||||
|
||||
console.log("release readiness tests passed");
|
||||
Reference in New Issue
Block a user