CLI Usage
Build your TypeScript project, then run fwa. It reads the project config,
validates the compiled tests, and passes them to the built-in node:test runner.
The overview shows installation and the first test run. See TypeScript configuration and how the runner handles stale tests.
Node.js Runtime
fwa runs compiled tests with the same Node.js executable that launched the
CLI. It does not select, download, or manage a different Node.js runtime.
With the default process isolation, the native test runner starts child
processes with the current runtime. With none isolation, tests run in the
current process. --node-args passes flags to isolated test processes. it does
not select another executable.
fwa requires Node.js >=20.19.0. Use separate CI jobs to verify your
project against the other Node.js versions it supports.
npm Scripts
Add build and test scripts to package.json. To remove tests with no source
file when running the suite, include --prune.
{
"scripts": {
"build": "tsc",
"test": "fwa --prune"
}
}
Build the project before running the tests.
npm run build
npm test
For manual runs, use the commands below from the project directory through npm exec.
Common Commands
Run tests for the current working directory.
npm exec -- fwa
Pass a path to run tests from another project root.
npm exec -- fwa ./packages/example
Select a specific TypeScript project config.
npm exec -- fwa --project tsconfig.test.json
npm exec -- fwa -p tsconfig.test.json
npm exec -- fwa ./packages/example --project tsconfig.test.json
Enable pruning for compiled tests whose source files were deleted.
npm exec -- fwa --prune
Pass Node.js flags to isolated test child processes.
npm exec -- fwa --node-args --no-warnings --conditions=development
npm exec -- fwa ./packages/example --node-args --no-warnings
--node-args must be the last fwa option because all following arguments are
passed to Node.js test processes.
Options
Usage: fwa [project-root] [options]
Options:
-p, --project <path> TypeScript config file or directory.
--prune Prune stale compiled tests without source.
-i, --isolation <mode> Test isolation: process or none. Default: process.
--node-args <args...> Pass remaining args to Node test processes.
-h, --help Show help.
-v, --version Show version.
The options have the following requirements.
- No positional project root means current working directory.
- At most one positional project root is allowed.
--projectcan be used once.--projectexpects a separate value, as in--project tsconfig.test.json.--projectaccepts a config file or a directory containingtsconfig.json.--project <path>is resolved relative to the selected project root.--pruneprunes stale compiled tests whose source files no longer exist.--prunerequiresoutDirto be a dedicated directory inside the selected project root.--isolationcan beprocessornone.--isolationrequires Node.js>=22.8.0.--node-argsconsumes all remaining arguments.--node-argsmust be the lastfwaoption.--node-argsrequires Node.js>=22.10.0.--node-argscannot be used with--isolation none.--help,-h,--version, and-vmust be used as standalone arguments.--source-dirand--dist-dirare not supported.
Exit Code Behavior
fwa does not call process.exit() directly.
On execution failure, or when no runnable tests are found, it sets the following exit code.
process.exitCode = 1;
This keeps process lifecycle under Node.js control and makes the runner easier to test.
Test File Discovery
This command relies on the shell to expand test file patterns.
node --test dist/**/*.test.js dist/**/*.spec.js
Different shells and environments can expand ** differently. In npm scripts,
that makes recursive test discovery less predictable across local machines,
containers, and CI.
fwa avoids this by walking outDir itself and passing explicit file paths to
node:test.