ci-config.spec.js
691 Bytes
const fs = require("node:fs");
const path = require("node:path");
const yaml = require("js-yaml");
const rootDir = path.resolve(__dirname, "../..");
describe("gitLab CI 知识图谱门禁", () => {
it("应在 Merge Request 中阻断图谱测试或漂移检查失败", () => {
const config = yaml.load(fs.readFileSync(path.join(rootDir, ".gitlab-ci.yml"), "utf8"));
const job = config.knowledge_graph_check;
expect(job).toBeDefined();
expect(job.allow_failure).toBe(false);
expect(job.rules).toContainEqual({
if: "$CI_PIPELINE_SOURCE == \"merge_request_event\"",
});
expect(job.script).toEqual([
"npm run knowledge:test",
"npm run knowledge:check",
]);
});
});