Comparing version 1.3.2 to 1.3.3
{ | ||
"name": "esmock", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"description": "mock es modules for unit-tests", | ||
"author": "Chris <chris@bumblehead.com>", | ||
"description": "provides native ESM import mocking for unit tests", | ||
"author": "chris <chris@bumblehead.com>", | ||
"main": "src/esmockLoader.mjs", | ||
@@ -9,0 +9,0 @@ "module": "src/esmockLoader.mjs", |
@@ -5,3 +5,3 @@ esmock | ||
**esmock provides native ESM import mocking on a per-unit basis.** Use the examples below as a quick-start guide or find a [descriptive and more friendly esmock guide here.][10] | ||
**esmock provides native ESM import mocking for unit tests.** Use the examples below as a quick-start guide or use a [descriptive and more friendly esmock guide here.][10] | ||
@@ -16,3 +16,3 @@ | ||
esmock must be used with node's experimental --loader | ||
`esmock` must be used with node's experimental --loader | ||
``` json | ||
@@ -29,4 +29,13 @@ { | ||
Use it `await esmock('./to/module.js', childmocks, globalmocks)` | ||
`esmock` has the following signature | ||
``` javascript | ||
await esmock( | ||
'./to/module.js', // the path to the target module being tested | ||
{ ...childmocks }, // mocked definitions imported by the target module | ||
{ ...globalmocks } // mocked definitions imported everywhere else | ||
); | ||
``` | ||
unit-test examples, using `esmock` and `ava` for various situations | ||
``` javascript | ||
import test from 'ava'; | ||
@@ -81,2 +90,4 @@ import esmock from 'esmock'; | ||
* 1.3.3 _Nov.28.2021_ | ||
* update quick-start README to include phrase 'unit test' | ||
* 1.3.2 _Nov.27.2021_ | ||
@@ -83,0 +94,0 @@ * use quick-start README with link to more descriptive README |
17077
134