Documentation Index
Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
veryfront/testing
Cross-runtime test utilities — BDD framework (describe/it), assertions, test isolation, filesystem/env helpers, and timing utilities for Deno, Node, and Bun.
Import
import {
afterAll,
afterEach,
assert,
assertEquals,
assertExists,
assertGreater,
} from "veryfront/testing";
Examples
import { assertEquals, describe, it } from "veryfront/testing";
describe("math", () => {
it("adds numbers", () => {
assertEquals(1 + 1, 2);
});
});
Exports
Functions
| Name | Description | Source |
|---|
afterAll | Register a hook after all BDD tests in a group. | source |
afterEach | Register a hook after each BDD test. | source |
assert | Assert that a value is truthy. | source |
assertEquals | Assert that two values are deeply equal. | source |
assertExists | Assert that a value is not null or undefined. | source |
assertGreater | Assert that a number is greater than another number. | source |
assertGreaterOrEqual | Assert that a number is greater than or equal to another number. | source |
assertInstanceOf | Assert that a value is an instance of a constructor. | source |
assertLess | Assert that a number is less than another number. | source |
assertLessOrEqual | Assert that a number is less than or equal to another number. | source |
assertMatch | Assert that a string matches a regular expression. | source |
assertNotEquals | Assert that two values are not deeply equal. | source |
assertNotStrictEquals | Assert that two values are not strictly equal. | source |
assertObjectMatch | Assert that an object contains matching properties. | source |
assertRejects | Assert that an async function rejects. | source |
assertStrictEquals | Assert that two values are strictly equal. | source |
assertStringIncludes | Assert that a string contains another string. | source |
assertThrows | Assert that a synchronous function throws. | source |
beforeAll | Register a hook before all BDD tests in a group. | source |
beforeEach | Register a hook before each BDD test. | source |
chmod | Change file permissions. | source |
createFileSystem | Create file system. | source |
cwd | Return the current working directory. | source |
deepEquals | ********************* Shared utility functions for cross-runtime testing. ********************* | source |
delay | Wait for a duration in milliseconds. | source |
deleteEnv | Delete a process environment variable. | source |
describe | Group related BDD tests. | source |
env | Read and write process environment variables. | source |
exists | Check whether a path exists. | source |
exit | Exit the current process. | source |
fail | Fail the current assertion immediately. | source |
getArgs | Get command-line arguments (cross-runtime: Deno.args or process.argv). | source |
getEnv | Read an environment variable from the active project scope. | source |
getTestTimeScale | Return test time scale. | source |
isAlreadyExistsError | Error shape for is already exists. | source |
isNotFoundError | Error shape for is not found. | source |
it | Define a BDD test case. | source |
makeTempDir | Create temp dir. | source |
makeTempDirWithOptions | Options accepted by make temp dir with. | source |
makeTempFile | Create temp file. | source |
mkdir | Create a directory. | source |
readDir | Read directory entries. | source |
readFile | Read a file as bytes. | source |
readTextFile | Read a file as text. | source |
registerTestCleanup | Registers test cleanup. | source |
remove | Remove a file or directory. | source |
resetAllTestState | Comprehensive reset of ALL test state across the application. | source |
safeStringify | Serialize unknown values safely for test output. | source |
scaleMs | Scale a duration for the current test runtime. | source |
setEnv | Sets env. | source |
stat | Read file metadata. | source |
testDelay | Wait for a test-scaled duration. | source |
waitFor | Wait until a condition succeeds. | source |
withEnv | Applies env. | source |
withTempDir | Applies temp dir. | source |
withTempFile | Applies temp file. | source |
writeFile | Write bytes to a file. | source |
writeTextFile | Write text to a file. | source |
Types
| Name | Description | Source |
|---|
BddTestContext | Context passed to hooks and tests (BDD-specific) | source |
TestOptions | Test options for Deno sanitizers (ignored in Node/Bun) | source |
Constants
| Name | Description | Source |
|---|
isBun | True if running in Bun runtime (check first since Bun has process.versions.node) | source |
isDeno | True if running in real Deno runtime (not dnt shim) | source |
isNode | True if running in Node.js runtime (has process.versions.node, not Bun, not shimmed Deno) | source |
test | Shared test value. | source |
Deep imports
These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.
veryfront/testing/assert
import { assert, assertEquals, assertExists } from "veryfront/testing/assert";
Functions
| Name | Description | Source |
|---|
assert | Assert that a value is truthy. | source |
assertEquals | Assert that two values are deeply equal. | source |
assertExists | Assert that a value is not null or undefined. | source |
assertGreater | Assert that a number is greater than another number. | source |
assertGreaterOrEqual | Assert that a number is greater than or equal to another number. | source |
assertInstanceOf | Assert that a value is an instance of a constructor. | source |
assertLess | Assert that a number is less than another number. | source |
assertLessOrEqual | Assert that a number is less than or equal to another number. | source |
assertMatch | Assert that a string matches a regular expression. | source |
assertNotEquals | Assert that two values are not deeply equal. | source |
assertNotStrictEquals | Assert that two values are not strictly equal. | source |
assertObjectMatch | Assert that an object contains matching properties. | source |
assertRejects | Assert that an async function rejects. | source |
assertStrictEquals | Assert that two values are strictly equal. | source |
assertStringIncludes | Assert that a string contains another string. | source |
assertThrows | Assert that a synchronous function throws. | source |
fail | Fail the current assertion immediately. | source |
Types
| Name | Description | Source |
|---|
ErrorClass | Public API contract for error class. | source |
veryfront/testing/bdd
Portable BDD testing utilities (describe, it, beforeEach, afterEach). In Deno: Direct re-export from @std/testing/bdd (no wrapper) In Node.js: Uses node:test In Bun: Uses bun:test
import { afterAll, afterEach, beforeAll } from "veryfront/testing/bdd";
Functions
| Name | Description | Source |
|---|
afterAll | Register a hook after all BDD tests in a group. | source |
afterEach | Register a hook after each BDD test. | source |
beforeAll | Register a hook before all BDD tests in a group. | source |
beforeEach | Register a hook before each BDD test. | source |
describe | Group related BDD tests. | source |
initBdd | Initialize the BDD test adapter. | source |
it | Define a BDD test case. | source |
Types
| Name | Description | Source |
|---|
BddTestContext | Context passed to hooks and tests (BDD-specific) | source |
HookFn | Hook function | source |
TestFn | Test function that can be sync or async | source |
TestOptions | Test options for Deno sanitizers (ignored in Node/Bun) | source |
Constants
| Name | Description | Source |
|---|
test | Shared test value. | source |
User guides: