From fb844454aa6192e9cce4b72a50bfdbb19f87294c Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Mon, 5 Aug 2024 18:40:51 +0300 Subject: [PATCH] doc: why --- README.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b4244d8..5f52b31 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @exodus/test -A runner for `node:test`, `jest`, and `tape` test suites on top of `node:test` +A runner for `node:test`, `jest`, and `tape` test suites on top of `node:test` (and any runtime) Most likely it will just work on your simple jest tests as as drop-in replacement @@ -10,6 +10,46 @@ Use `--coverage` to generate coverage output Default `NODE_ENV` value is "test", use `NODE_ENV=` to override (e.g. to empty) +## Why? + +- Can run your tests on Node.js, Bun, Deno, JavaScriptCore and Hermes without extra churn + +- Unlike `jest`, it is fast + +- Unlike `node:test`, it is a drop-in replacement for `jest` + + - With `expect`, support for snapshots, mocks and matchers + + - `jest-when` and `jest-extended` are fully compatible and can just be used + + - Snapshots are compatible with Jest and can just be used both ways + + - Also compatible to `node:test` + +- Unlike `bun:test`, it runs all test files in isolated contexts + + Bun leaks globals between test files and has incompatible `test()` lifecycle / order + +- Can use Jest config + +- Native coverage support (enable via `--coverage`) + +- Can record / replay `fetch` and `WebSocket` sessions. And run them on all runtimes (including Hermes) + +- Automatic polyfills for JavaScriptCore / Hermes, including crypto + +- Hanging tests error by default (unlike `jest`) + +- Native ESM out of the box + +- Esbuild on the fly for babelified ESM interop (enable via `--esbuild`) + +- TypeScript support in both transform (enable via `--esbuild`) and typestrip (via `--typescript`) modes + +- Babel support, picks up your Babel config (enable via `--babel`) + +- `--drop-network` support for guaranteed offline testing + ## Library ### Using with `node:test` natively