Comparing version 1.6.3 to 1.6.4
{ | ||
"name": "esmock", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "readmeFilename": "README.md", |
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] | ||
[![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] [![install size](https://packagephobia.now.sh/badge?p=esmock)](https://packagephobia.now.sh/result?p=esmock) [![downloads](https://badgen.now.sh/npm/dm/esmock)](https://npmjs.org/package/esmock) | ||
@@ -36,3 +36,3 @@ **esmock provides native ESM import mocking for unit tests.** Use examples below as a quick-start guide or use the [descriptive and friendly esmock guide here.][10] | ||
unit-test examples, using `esmock` and `ava` for various situations | ||
`esmock` demonstrated with `ava` unit test examples | ||
``` javascript | ||
@@ -44,3 +44,3 @@ import test from 'ava'; | ||
const main = await esmock('../src/main.js', { | ||
stringifierpackage : o => JSON.stringify(o), | ||
stringifierpackage : JSON.stringify, | ||
'../src/hello.js' : { | ||
@@ -71,3 +71,3 @@ default : () => 'world', | ||
// cached mock definition is there when import is called | ||
// mock definition is there, in cache, when import is called | ||
t.is(await doAwaitImport('cfg'), 'cfg'); | ||
@@ -81,9 +81,8 @@ | ||
// use the form you prefer in your test | ||
t.is(main(), main.default()); | ||
t.is(main(), main.default()); // use the form you prefer | ||
}); | ||
test('should mock "default" value, when safe', async t => { | ||
test('should define "default" implicily, when safe', async t => { | ||
const mainA = await esmock('../src/exportsMain.js', { | ||
'../src/main.js' : () => 'mocked main' | ||
'../src/main.js' : () => 'mocked main' // short-hand, smaller | ||
}); | ||
@@ -90,0 +89,0 @@ const mainB = await esmock('../src/exportsMain.js', { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16850
92