Registry / testing / deno-test

deno-test

JSON →
library1.0.2jsnpmunverified

Run Deno-style tests (Deno.test, t.step) on Node.js without rewriting test files. v1.0.2 requires Node.js >=23.6.0 for its sync module hooks. Resolution uses @deno/loader to handle jsr:, @std/*, and import maps. Outputs results via node:test runner. Ideal for checking Node.js compatibility of Deno-first packages.

npm install deno-test
INSTALL
IMPORT
SIG · DENO-TEST
D
deno-test
testingjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Deno.test
✓ // no import needed; Deno.test is global when using deno-test CLI
✗ import { Deno } from 'deno-test';
Deno.test is globally injected via @deno/shim-deno-test when file is loaded by CLI.
assertEquals
✓ import { assertEquals } from '@std/assert';
✗ import { assertEquals } from 'https://deno.land/std/assert/mod.ts';
Use jsr: specifiers or import map; raw URL imports not supported.
t.step
✓ Deno.test('name', async (t) => { await t.step('sub', () => {}); });
✗ t.step('sub', () => {}); // missing await
t.step must be awaited; maps to node:test subtests.
register-deno-hooks
✓ // not imported; CLI handles automatically
✗ import 'deno-test/register-deno-hooks.mjs';
The hooks module is internal; do not import directly.

Demonstrates writing a Deno-style test and running it on Node.js via npx.

// Create a test file: math_test.ts import { assertEquals } from '@std/assert'; Deno.test('add', () => { assertEquals(1 + 1, 2); }); // Run with npx deno-test (no extra config) // Requires deno.json with import map referencing @std/assert // > npx deno-test
Debug
Known issues
breakingNode.js >= 23.6.0 required (uses module.registerHooks())
fix
Upgrade Node.js to 23.6.0 or later.
affects: <=1.0.2
gotchaImport maps must be in deno.json; other config files are not supported
fix
Place import map in deno.json at project root.
affects: <=1.0.2
gotchaRaw URL imports (https://deno.land/...) are not resolved; use jsr: or import map
fix
Use jsr:@scope/pkg or add to import map in deno.json.
affects: <=1.0.2
deprecatedDeno.test steps must be async callbacks; sync callbacks may cause unexpected results
fix
Always use async (t) => callback with await t.step().
affects: <=1.0.2
gotchaFiles in node_modules, .git, vendor are skipped automatically
fix
No fix needed; be aware of discovery scope.
affects: <=1.0.2
breakingSupports only Deno.test and t.step; other Deno globals (e.g., Deno.readFile) are not available
fix
Polyfill missing Deno APIs separately or avoid them in tests.
affects: <=1.0.2
gotchaOutput uses node:test reporter; may differ from Deno's test output formatting
fix
Use --reporter flag of node:test if needed.
affects: <=1.0.2
Errors
Common errors & fixes
Cannot find module 'register-deno-hooks.mjs' required by 'deno-test'
Node.js version < 23.6.0; module.registerHooks() not available
fix
Upgrade to Node.js >= 23.6.0
TypeError: Deno.test is not a function
Test file not loaded by deno-test CLI; trying to import directly in Node.js
fix
Run file with npx deno-test [file] instead of node
Error: Unsupported file extension .ts for import map resolution
Missing or misconfigured import map in deno.json
fix
Ensure deno.json exists at project root with correct 'imports'
Test steps not executed: step callback must be async
t.step called without await in async callback
fix
Use await t.step() inside async (t) => {}
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
@deno/loaderrequiredModule resolution for Deno-style imports (jsr:, @std/*)
@deno/shim-deno-testrequiredProvides Deno.test and t.step shim for Node.js
Agent activity
5 hits · last 30 days
node
5
Resources
deno-test — npm install deno-test · libregistry