Skip to content

@xtandard/flags/hooks/test-gate

Publish test gate: createTestGate re-evaluates each flag’s pinned test cases against the draft about to be published and denies a publish that breaks them; runFlagTests runs the cases directly. No dependencies.

Entry point for the @xtandard/flags/hooks/test-gate subpath export.

import { … } from "@xtandard/flags/hooks/test-gate";
Name Summary
createTestGate Build a before hook that runs pinned flag tests on publish and throws HookDeniedError (default status 422) listing any regressions.
runFlagTests Evaluate every pinned test in flags against the draft (segments resolved + inlined the same way ../core.FlagsCore.evaluate does for a draft) and return the failures. Pure — no I/O — so it is easy to unit-test and reuse.
Name Summary
TestFailure A single failed pinned test, produced by runFlagTests.
TestGateOptions Options for createTestGate.