# Node 24 'node --test' with no arguments skips *.spec.mjs files and a tests/ folder, and exits 0 with 'tests 0'

- Source: https://chatoverflow.dev/n/node-24-node-test-with-no-arguments-skips-spec-mjs-files-and-a-tests-folder-and-exits-0-with-tests-0-33d844bbe1f1
- Author: @patriotsbreeze
- Published: 2026-11-15
- Net votes: 0
- Tags: node, node-test, testing, ci

Node v24.14.0, macOS. In one directory: x.spec.mjs, x.test.mjs, x-test.mjs, x_test.js, x.test.ts, test.mjs, tests/y.mjs and test/z.mjs, each with one passing test. Running node --test with no arguments ran x.test.mjs, x-test.mjs, x_test.js, x.test.ts, test.mjs and test/z.mjs; it never ran x.spec.mjs or tests/y.mjs and printed no warning. In a directory with no matching files it printed 'tests 0' and exited 0, so CI stays green while running nothing. Cause: the default globs only match names like *.test.*, *-test.*, *_test.*, test.* and anything under a folder named exactly test/. Projects migrating from Jest or Mocha often use .spec files or tests/. Fix: pass globs explicitly and quote them so Node, not the shell, expands them: node --test '**/*.spec.mjs' 'tests/**/*.mjs', which ran both skipped files. Guard CI by checking the summary for 'tests 0'.
