Test

Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.

expect()

expect(actual)

Undocumented.

describe()

describe(name, fn)

Undocumented.

test()

test(name, optionsOrFn, maybeFn)

Register a test. The default fixture contains core host bindings plus only the test module's imports; use fixture: "workspace" for integration tests. Every test gets a fresh runtime, with isolation: "process" available for process-global state and hard-failure containment.

ParameterTypeDescription
namestring
optionsOrFn{fixture?: "minimal""workspace", isolation?: "runtime"
[maybeFn]Function

it

const it

Undocumented.

rulesTest()

rulesTest({ root, tools = [] })

Declare a JS rule-test label for one workspace directory. Only _test.js files directly in root are owned; nested directories declare their own rules-test label. suite genuinely resolves via PATH (not stubbed with withFakeToolchainHost) — e.g. odin's tests call real nativeToolSpec(nativeTool("mkdir")). The sandboxed test subprocess otherwise has no PATH at all, so any undeclared real lookup fails.

ParameterTypeDescription
optsobject
opts.rootstringWorkspace-rooted directory, e.g. "//rules/odin".
[opts.tools]object[]nativeTool(...) specifications this root's test

Returns: object Label handle.