Skip to main content

check

function

Declare a self-verification the host runs before it activates the mod. Checks are a gate, not a report. They run in order once everything else in the generation is staged. The first one to throw or fail an assert stops the run, the staged contributions roll back, and the generation is quarantined with the failure message as evidence. So a check that fails keeps a broken mod off the user's machine rather than letting it half-load. Use one to confirm the mod's own contributions really landed, for example that a command it depends on is registered. This is not the place for unit tests of your logic. It answers "did I wire myself up correctly here", which only the running host can tell you.

function check<TName extends string>(checkValue: CheckInput<TName>): CheckDeclaration<TName>

Import

import { check } from '@modular/sdk';

Notes

example
```ts check({ name: 'my-mod.registered', run: async ctx => { const action = await ctx.describeAction('command:my-mod.hello'); ctx.assert(action !== null, 'my-mod.hello did not register'); }, }); ```
category
Authoring