Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esmock

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esmock - npm Package Compare versions

Comparing version 1.6.3 to 1.6.4

2

package.json
{
"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', {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc