UT Test Library
raw JSON → 6.1.17 verified Sat Apr 25 auth: no javascript
A testing library for the UT framework, providing utilities for unit and integration testing. The current stable version is 6.1.17, with infrequent releases. It is designed primarily for use within the UT ecosystem, differentiating itself by tight integration with UT's module system and conventions. Not intended for general-purpose testing outside of UT projects.
Common errors
error Cannot find module 'ut-test' ↓
cause Package not installed or wrong import path.
fix
Run npm install ut-test and use correct import syntax.
error require is not defined in ES module scope ↓
cause Using require() with ESM-only package.
fix
Switch to import statements.
Warnings
breaking ESM only since v2 ↓
fix Use import syntax instead of require.
gotcha No browser support ↓
fix Only use in Node.js environment.
deprecated someFunction is deprecated and will be removed in v7 ↓
fix Use newFunction instead.
Install
npm install ut-test yarn add ut-test pnpm add ut-test Imports
- default wrong
const utTest = require('ut-test')correctimport utTest from 'ut-test' - test wrong
const { test } = require('ut-test')correctimport { test } from 'ut-test' - describe wrong
const describe = require('ut-test').describecorrectimport { describe } from 'ut-test'
Quickstart
import { test, describe, expect } from 'ut-test';
describe('example', () => {
test('should work', () => {
expect(1 + 1).toBe(2);
});
});