zena:test
zena
import {…} from 'zena:test';
Classes
TestContext
zena
class TestContext
Test context passed to each test function
TestResult
zena
class TestResult
Result of a single test execution
SuiteResult
zena
class SuiteResult
Suite
zena
class Suite
A test suite containing tests and nested suites
Functions
test
zena
function test(name: String, fn: (ctx: TestContext) => void): void
Register a test in the current suite
testOnly
zena
function testOnly(name: String, fn: (ctx: TestContext) => void): void
Register a test that will be the only one to run (for debugging)
testSkip
zena
function testSkip(name: String, fn: (ctx: TestContext) => void): void
Register a test that will be skipped
suite
zena
function suite(name: String, fn: () => void): Suite
Create a test suite
runAndReport
zena
function runAndReport(s: Suite, write: (s: String) => void): i32
Run a suite, print results, and return the number of failures. This is the standard entry point for test runners.
Usage in a test wrapper: import { tests } from './my_test.zena'; import { runAndReport } from 'zena:test'; export let main = (): i32 => runAndReport(tests, console.log);