Skip to content

Commit

Permalink
Merge pull request #28 from iambumblehead/add-phrase-unit-test-to-readme
Browse files Browse the repository at this point in the history
update README
  • Loading branch information
iambumblehead authored Nov 28, 2021
2 parents ad9b2a1 + d6eefa9 commit 2ebda67
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ esmock
======
[![npm version](https://badge.fury.io/js/esmock.svg)](https://badge.fury.io/js/esmock) [![Build Status](https://github.com/iambumblehead/esmock/workflows/nodejs-ci/badge.svg)][2]

**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]


[10]: https://github.com/iambumblehead/esmock/wiki/How-to-use-esmock
Expand All @@ -12,7 +12,7 @@ esmock



esmock must be used with node's experimental --loader
`esmock` must be used with node's experimental --loader
``` json
{
"name": "give-esmock-a-star",
Expand All @@ -24,7 +24,16 @@ esmock must be used with node's experimental --loader
}
```

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';
import esmock from 'esmock';
Expand Down Expand Up @@ -75,6 +84,8 @@ test('should mock "await import()" using esmock.p', async t => {
<summary>changelog</summary>
<br/>

* 1.3.3 _Nov.28.2021_
* update quick-start README to include phrase 'unit test'
* 1.3.2 _Nov.27.2021_
* use quick-start README with link to more descriptive README
* 1.3.1 _Nov.26.2021_
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "esmock",
"version": "1.3.2",
"version": "1.3.3",
"license": "MIT",
"readmeFilename": "README.md",
"description": "mock es modules for unit-tests",
"author": "Chris <[email protected]>",
"description": "provides native ESM import mocking for unit tests",
"author": "chris <[email protected]>",
"main": "src/esmockLoader.mjs",
"module": "src/esmockLoader.mjs",
"type": "module",
Expand Down

0 comments on commit 2ebda67

Please sign in to comment.