Registry / testing / tman
library0.0.1jsnpmunverified

T-man is a lightweight and flexible JavaScript test manager, designed as a refactored alternative to Mocha. It aims for direct compatibility with Mocha's testing style in most scenarios, offering similar `suite`, `test`, `before`, `after` hooks, and exclusive/inclusive test mechanisms. The current stable version is 1.10.0. While no explicit release cadence is documented, it maintains a stable API in its 1.x series. T-man supports various asynchronous testing patterns, including callbacks, Promises, Thunks, Generators, Rx.Observable, and async/await functions. It ships with TypeScript typings, facilitating its use in modern TypeScript projects. Its key differentiators lie in its minimalist design and adaptability, while still providing robust test management features comparable to more established frameworks.

npm install tman
INSTALL
IMPORT
SIG · TMAN
T
tman
testingjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tman
import tman from 'tman'
import { tman } from 'tman'
T-man primarily exports a default object containing all its utilities. Direct named imports are not supported.
tman (CommonJS)
const tman = require('tman')
const { tman } = require('tman')
For CommonJS environments (Node.js <12 without ESM support), use `require` to import the default export.
it
tman.it('...', () => { /* ... */ })
import { it } from 'tman'
Test definition functions like `it` (or `test`) are methods on the imported `tman` object, not direct named exports.

Demonstrates synchronous and various asynchronous testing patterns (callback, promise, thunk, async/await) using T-man's `it` function, then executes them.

import tman from 'tman'; import assert from 'assert'; let count = 0; tman.it('synchronous test', function () { assert.strictEqual(count++, 0); }); tman.it('callback style asynchronous test', function (done) { assert.strictEqual(count++, 1); setTimeout(done, 100); }); tman.it('promise style asynchronous test', function () { assert.strictEqual(count++, 2); return new Promise<void>(function (resolve) { assert.strictEqual(count++, 3); setTimeout(resolve, 100); }); }); tman.it('thunk style asynchronous test', function () { assert.strictEqual(count++, 4); return function (done: (err?: any) => void) { assert.strictEqual(count++, 5); setTimeout(done, 100); }; }); tman.it('async/await style asynchronous test', async function () { assert.strictEqual(count++, 6); await new Promise<void>(resolve => setTimeout(resolve, 50)); assert.strictEqual(count++, 7); }); tman.run(); // This line is crucial to execute the defined tests.
tman --version
Debug
Known issues
gotchaAlthough T-man aims for direct replacement of Mocha in most cases, subtle differences in behavior or configuration might exist, especially with advanced Mocha features or specific reporter integrations. Always verify behavior when migrating complex test suites.
fix
Thoroughly test existing Mocha suites after migrating to T-man to ensure all edge cases and configurations behave as expected. Consult T-man's documentation for any known incompatibilities.
affects: >=1.0.0
gotchaAsynchronous tests in T-man, like many test frameworks, require explicit completion signals. If a Promise is not returned, a Thunk is not yielded, an Observable is not returned, or `done()` is not called in a callback-style test, the test will either time out or pass prematurely, leading to false positives.
fix
Ensure asynchronous tests explicitly return a Promise, Thunk, or Rx.Observable, or call the provided `done` callback exactly once when the asynchronous operation completes or fails.
affects: >=1.0.0
Errors
Common errors & fixes
Timeout of Xms exceeded.
An asynchronous test did not complete within the allotted timeout period, often due to a forgotten `done()` call, an unreturned Promise/Thunk/Observable, or a hanging operation.
fix
Review the asynchronous test logic to ensure it correctly signals completion (e.g., calling `done()`, returning a Promise, Thunk, or Observable). Increase the timeout if the operation genuinely takes longer using `tman.timeout(ms)` or `this.timeout(ms)` within a test.
tman is not a function
This usually indicates an incorrect import statement, such as attempting a named import `{ tman }` instead of a default import `tman`, or a CommonJS/ESM module conflict.
fix
For ES Modules/TypeScript, use `import tman from 'tman';`. For CommonJS, use `const tman = require('tman');`. Ensure you are not trying to destructure specific functions like `{ it }` from the top-level import.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
tman — npm install tman · libregistry