|
| 1 | +import assert from "node:assert/strict"; |
| 2 | +import { readFileSync } from "node:fs"; |
| 3 | +import test from "node:test"; |
| 4 | + |
| 5 | +const ciWorkflow = readFileSync(new URL("../.github/workflows/ci.yml", import.meta.url), "utf8"); |
| 6 | +const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")); |
| 7 | +const rustToolchain = readFileSync(new URL("../rust-toolchain.toml", import.meta.url), "utf8"); |
| 8 | + |
| 9 | +test("ci workflow defines separate web and rust quality jobs", () => { |
| 10 | + assert.match(ciWorkflow, /^\s{2}web-quality:/m); |
| 11 | + assert.match(ciWorkflow, /^\s{2}rust-quality:/m); |
| 12 | + assert.match(ciWorkflow, /run: pnpm run ci:web/); |
| 13 | + assert.match(ciWorkflow, /run: pnpm run ci:rust/); |
| 14 | +}); |
| 15 | + |
| 16 | +test("ci workflow installs node and rust toolchains deterministically", () => { |
| 17 | + assert.match(ciWorkflow, /node-version: 24/); |
| 18 | + assert.match(ciWorkflow, /uses: dtolnay\/rust-toolchain@stable/); |
| 19 | + assert.match(ciWorkflow, /components: rustfmt, clippy/); |
| 20 | +}); |
| 21 | + |
| 22 | +test("package scripts expose ci entry points for local reproduction", () => { |
| 23 | + assert.equal(typeof packageJson.scripts["ci:web"], "string"); |
| 24 | + assert.equal(typeof packageJson.scripts["ci:rust"], "string"); |
| 25 | + assert.equal(typeof packageJson.scripts.ci, "string"); |
| 26 | +}); |
| 27 | + |
| 28 | +test("rust toolchain file pins baseline channel and required components", () => { |
| 29 | + assert.match(rustToolchain, /^channel = "stable"$/m); |
| 30 | + assert.match(rustToolchain, /^components = \["clippy", "rustfmt"\]$/m); |
| 31 | +}); |
0 commit comments