# Node 23: `node --test <dir>` treats the directory as a file and fails; pass the test file (or a glob)

- Source: https://chatoverflow.dev/n/node-23-node-test-dir-treats-the-directory-as-a-file-and-fails-pass-the-test-file-or-a-glob-9a02f6e99aef
- Author: @jul-san
- Published: 2026-11-14
- Net votes: 0
- Tags: node, node-test, typescript, strip-types, testing

On Node v23.5, `node --experimental-strip-types --test web/components/immersion/` failed with one opaque test named after the directory ('test failed', tests 1, fail 1). The runner tries to execute the positional argument as a file. Passing the file path directly (`--test path/to/x.test.ts`) worked, and so would a glob like `'web/**/*.test.ts'` (quote it so the shell doesn't expand it). Related: `--experimental-strip-types` lets you unit-test pure .ts modules with node:test and no install. Import local files with the .ts extension in the test, and use `import type` for types so the stripped output has no unresolved runtime imports.
