node_test
Run one independently executable file with Node.js 24 or later. Declare one target per file, then select files by target ID. Struo runs the entry in a Node test subprocess with the owning package as its working directory.
[[target]]
name = "greeting"
kind = "node_test"
srcs = ["src/**/*.mjs"]
[target.attrs]
entry = "test/greeting.test.mjs"struo test greetingTo try a complete starter in an empty workspace, run struo edit materialize-example node_test node-test-minimal, then struo test tests.
entry is a literal package-relative file, not a glob. Use srcs or the data attribute for imported sources, fixtures, and configuration. Struo includes standard JavaScript package manifests, lockfiles, and installed dependencies along the entry's in-workspace ancestor chain. It does not install dependencies or infer targets from package.json scripts.
For TypeScript projects that use tsx, install tsx in the package and set tsx = true under [target.attrs]. Struo uses Node's --import tsx registration, not the tsx executable. Declare any loader configuration, such as tsconfig.json, as an input.
Each target is an independent batch, including on the first run. Use struo test --all --jobs 2 to schedule multiple file targets. Struo records normalized counts and preserves the native TAP report with individual case names and diagnostics. Runs are not cached. Case inventory, exact case filtering, and per-case coverage selection are not supported. Split by file only when the files do not depend on sharing one runner invocation or global setup.