mirror of
https://github.com/darkings/Obsidian-MonokaiSyntax.git
synced 2026-07-22 04:40:26 +00:00
修复发布版本标签校验
This commit is contained in:
parent
2ad8c14cd6
commit
8f784bd367
2 changed files with 27 additions and 1 deletions
|
|
@ -21,7 +21,7 @@ export function checkVersionConsistency({
|
|||
const packageVersion = packageJson.version;
|
||||
const manifestVersion = manifestJson.version;
|
||||
const minAppVersion = manifestJson.minAppVersion;
|
||||
const tagVersion = normalizeReleaseTag(releaseTag);
|
||||
const tagVersion = requireReleaseTag ? normalizeReleaseTag(releaseTag) : "";
|
||||
|
||||
if (!packageVersion) {
|
||||
failures.push("package.json 缺少 version 字段");
|
||||
|
|
|
|||
|
|
@ -24,3 +24,29 @@ test("版本检查报告不一致的中文错误", () => {
|
|||
assert.equal(result.passed, false);
|
||||
assert.match(result.failures.join("\n"), /manifest\.json 版本/);
|
||||
});
|
||||
|
||||
test("版本检查在分支工作流中不把分支名当发布标签", () => {
|
||||
const result = checkVersionConsistency({
|
||||
packageJson: { version: "1.1.0" },
|
||||
manifestJson: { version: "1.1.0", minAppVersion: "1.0.0" },
|
||||
versionsJson: { "1.1.0": "1.0.0" },
|
||||
releaseTag: "master",
|
||||
requireReleaseTag: false,
|
||||
});
|
||||
|
||||
assert.equal(result.passed, true);
|
||||
assert.deepEqual(result.failures, []);
|
||||
});
|
||||
|
||||
test("版本检查在标签发布中校验标签与 package 版本一致", () => {
|
||||
const result = checkVersionConsistency({
|
||||
packageJson: { version: "1.1.0" },
|
||||
manifestJson: { version: "1.1.0", minAppVersion: "1.0.0" },
|
||||
versionsJson: { "1.1.0": "1.0.0" },
|
||||
releaseTag: "master",
|
||||
requireReleaseTag: true,
|
||||
});
|
||||
|
||||
assert.equal(result.passed, false);
|
||||
assert.match(result.failures.join("\n"), /发布标签 master/);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue