fwa Node.js
On this page

Stale Compiled Tests

During suite preparation, fwa checks that every discovered compiled test has a matching source TypeScript test and is not older than that source.

This detects files with missing sources and tests that changed after compilation. The runner checks file existence and modification times.

Matching Source Exists

If the source test exists and the compiled file is not older, the compiled test is runnable. The two paths below form such a pair.

Code
src/feature/example.test.ts
dist/feature/example.test.js

Source Test Was Deleted

If the source test no longer exists, the runner leaves the compiled file in place and reports an error.

Code
Stale compiled tests without source found.

Run with --prune to remove them:
- dist/feature/old.test.js

The --prune option removes the compiled test and reports the removal.

Code
Pruned stale compiled tests without source:
- dist/feature/old.test.js

If --prune removes all discovered tests, the files are deleted and the CLI and runSuite set process.exitCode = 1. prepareSuite returns an empty plan. Async execution returns status: 'empty' and exitCode: 1 without changing process.exitCode.

For safety, pruning requires outDir to be a dedicated directory inside the selected project root. It is rejected when outDir is the project root, resolves outside it, or is a symlink to an external directory.

The full test list is validated before deletion. If another compiled test is outdated, pruning does not remove any files and the run fails with the rebuild diagnostic.

Source Test Is Newer

If the source test is newer than the compiled test, the runner asks you to rebuild the project.

Code
Compiled tests are older than source tests.

Rebuild before npm test:
- dist/feature/example.test.js (source: src/feature/example.test.ts)

Rebuild the project before running the tests.

Shell
npm run build
npm test

How Freshness Is Checked

The runner compares the last modification times of each source test and its compiled file. This check covers tests. Rebuild the project before running fwa to update the other compiled files too.