fwa Node.js
On this page

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.

JSON
{
  "scripts": {
    "build": "tsc",
    "test": "fwa --prune"
  }
}

Build the project before running the tests.

Shell
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.

Shell
npm exec -- fwa

Pass a path to run tests from another project root.

Shell
npm exec -- fwa ./packages/example

Select a specific TypeScript project config.

Shell
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.

Shell
npm exec -- fwa --prune

Pass Node.js flags to isolated test child processes.

Shell
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

Code
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.
  • --project can be used once.
  • --project expects a separate value, as in --project tsconfig.test.json.
  • --project accepts a config file or a directory containing tsconfig.json.
  • --project <path> is resolved relative to the selected project root.
  • --prune prunes stale compiled tests whose source files no longer exist.
  • --prune requires outDir to be a dedicated directory inside the selected project root.
  • --isolation can be process or none.
  • --isolation requires Node.js >=22.8.0.
  • --node-args consumes all remaining arguments.
  • --node-args must be the last fwa option.
  • --node-args requires Node.js >=22.10.0.
  • --node-args cannot be used with --isolation none.
  • --help, -h, --version, and -v must be used as standalone arguments.
  • --source-dir and --dist-dir are 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.

TypeScript
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.

Shell
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.