Open source · Quality & Testing

Test Data Sanitizer

Scrub test data before fixtures enter repositories or build artifacts.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

An offline, fail-closed sanitizer for local JSON fixture datasets. It replaces every declared string value with a synthetic surrogate, preserves record keys and string/null types, and maps IDs in the same declared link group consistently across files. It does not contact a service, upload inputs, or write back to source files.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.

Run the checked-in example

node examples/run.mjs passing   # exit 0, disposable temporary output
node examples/run.mjs failing   # exit 1, unmapped field
npm run check

Read the result

Own inputs: node bin/test-data-sanitizer.mjs --root DIR --policy policy.json --out sanitized.json. All paths are relative to the real root and must resolve inside it. The output parent must exist. --out may overwrite an unrelated ordinary file, but not a symlink, a file reached through an escaping symlinked parent, or a hardlink alias to the policy or any named dataset input. Use only authorized local data; examples and tests contain synthetic canaries, never personal data.