test:ci now runs c8 with --all --include "src/**/*.ts" --100, so the build job fails when any runtime file under src/ is untested. --all is what makes the gate non-vacuous: without it c8 counts only the files the suite happened to load, and a new untested module stays invisible. Add src/index.test.ts to load the public barrel, which was previously never imported at runtime and so read as 0% under --all. matcher-shared.ts is types-only (an empty runtime image) and carries a file-level c8 ignore with the reason. Why 100% and the rejected alternatives: development/ci.md § Coverage threshold.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { strict as assert } from "node:assert";
|
|
import { test } from "node:test";
|
|
|
|
import { expectTypeOf } from "expect-type";
|
|
|
|
import {
|
|
getPrimitiveUnionMatcher,
|
|
getPrimitiveUnionMatcherW,
|
|
getTaggedUnionMatcher,
|
|
getTaggedUnionMatcherW,
|
|
} from "./index.ts";
|
|
|
|
// The published entry point is the barrel (`package.json` exports
|
|
// `./dist/index.js`), so every factory must be reachable from here. Importing it
|
|
// also loads the module, which is what lets c8's `--all` measure it — see
|
|
// development/ci.md § Coverage threshold.
|
|
test("index: the public entry point re-exports every matcher factory", () => {
|
|
// Assert
|
|
expectTypeOf(getPrimitiveUnionMatcher).toBeFunction();
|
|
assert.equal(typeof getPrimitiveUnionMatcher, "function");
|
|
expectTypeOf(getPrimitiveUnionMatcherW).toBeFunction();
|
|
assert.equal(typeof getPrimitiveUnionMatcherW, "function");
|
|
expectTypeOf(getTaggedUnionMatcher).toBeFunction();
|
|
assert.equal(typeof getTaggedUnionMatcher, "function");
|
|
expectTypeOf(getTaggedUnionMatcherW).toBeFunction();
|
|
assert.equal(typeof getTaggedUnionMatcherW, "function");
|
|
});
|