From a4e67ffe411ede5bab11e32b51e351e4e201641f Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 9 Sep 2023 14:15:20 -0700 Subject: [PATCH] update README --- README.md | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 3e7443b0..555f2b61 100644 --- a/README.md +++ b/README.md @@ -11,28 +11,7 @@ **esmock provides native ESM import and globals mocking for unit tests.** Use examples below as a quick-start guide, see the [descriptive and friendly esmock guide here,][4] or browse [esmock's test runner examples.][3] - -`esmock` is used with node's --loader -``` json -{ - "name": "give-esmock-a-star", - "type": "module", - "scripts": { - "test": "node --loader=esmock --test", - "test-mocha": "mocha --loader=esmock", - "test-tap": "NODE_OPTIONS=--loader=esmock tap", - "test-ava": "NODE_OPTIONS=--loader=esmock ava", - "test-uvu": "NODE_OPTIONS=--loader=esmock uvu spec", - "test-tsm": "node --loader=tsm --loader=esmock --test *ts", - "test-ts": "node --loader=ts-node/esm --loader=esmock --test *ts", - "test-jest": "NODE_OPTIONS=--loader=esmock jest", - "test-tsx": "⚠ https://github.com/esbuild-kit/tsx/issues/264" - }, - "jest": { - "runner": "jest-light-runner" - } -} -``` +Note: For older versions of node, less than version 20.6, `esmock` must be used with node's "--loader" as demonstrated [in the wiki.][4] Newer versions of node can use esmock as-is with no extra requirements. `esmock` has the below signature ``` javascript @@ -42,7 +21,7 @@ await esmock( { ...globalmocks }) // mock definitions imported everywhere ``` -`esmock` examples +`esmock` examples. ``` javascript import test from 'node:test' import assert from 'node:assert/strict'