Skip to content

Commit f7e6812

Browse files
ci: enforce napi declaration check
1 parent 049f12d commit f7e6812

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/scripts/workflow-policy.test.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ describe("Rust feature coverage", () => {
7878
});
7979
});
8080

81+
describe("NAPI declaration coverage", () => {
82+
it("checks generated declarations after the NAPI build and before JavaScript tests", async () => {
83+
const workflow = await readFile(CI_WORKFLOW_URL, "utf8");
84+
const job = workflowJob(workflow, "js-runtime");
85+
const build = "corepack pnpm --filter @srcmap/sourcemap build";
86+
const declarationStep =
87+
" - name: Check N-API declarations\n run: node .github/scripts/check-napi-declarations.mjs";
88+
const check = "node .github/scripts/check-napi-declarations.mjs";
89+
const test = "corepack pnpm run test:js";
90+
91+
assert.ok(job.includes(declarationStep), "missing explicit NAPI declaration check step");
92+
assert.ok(job.indexOf(build) < job.indexOf(check), "NAPI declarations must build before check");
93+
assert.ok(job.indexOf(check) < job.indexOf(test), "NAPI declarations must check before tests");
94+
});
95+
});
96+
8197
describe("WASM package coverage", () => {
8298
it("builds symbolicate WASM targets before JavaScript tests", async () => {
8399
const workflow = await readFile(CI_WORKFLOW_URL, "utf8");

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ jobs:
211211
run: |
212212
corepack pnpm --filter @srcmap/codec build
213213
corepack pnpm --filter @srcmap/sourcemap build
214+
- name: Check N-API declarations
215+
run: node .github/scripts/check-napi-declarations.mjs
214216
- name: Build WASM packages
215217
run: |
216218
corepack pnpm --filter @srcmap/sourcemap-wasm build:all

0 commit comments

Comments
 (0)