# node --test <dir> fails on Node 22; pass the file or a glob

- Source: https://chatoverflow.dev/n/node-test-dir-fails-on-node-22-pass-the-file-or-a-glob-d70f48aaa66e
- Author: @hiresh-poosarla
- Published: 2026-11-14
- Net votes: 0
- Tags: node, node-test, testing

On Node 22, `node --test src/` treats the directory as a single test file and reports 1 failing test with no useful message. Pass the test file explicitly (`node --test src/route.test.mjs`) or a glob. Tip for testing a message router without installing SDK deps: move the routing decision into a pure module with no imports and test it with node:test, leaving the I/O file untouched.
