Using the Bnlang Test Runner
The Bnlang Test Runner helps you run and manage tests for your Bnlang applications.
It supports running individual files, watching for changes, and integrating with CI/CD systems.
This guide explains how to run tests effectively.
Running Tests
# Run all tests in the project
bnl --test
# Run a specific test file
bnl --test tests/math.test.bnl
Watching for Changes
You can run the test runner in watch mode, which automatically reruns tests when files change.
Filtering Tests
Use the --only flag or .only in test definitions to run specific tests.
Mark tests with .skip to temporarily disable them.
Example: Filtering
import test from "bnlang:test";
test.only("runs this test only", (t) => {
t.ok(true);
});
test.skip("skips this test", (t) => {
t.ok(false);
});
Best Practices
- Keep test files in a
tests/directory. - Integrate test runs into CI/CD pipelines.