# Node.js: How to mock the imports of an ES6 module

DevFeed: [Node.js: How to mock the imports of an ES6 module](<https://devfeed.tech/articles/node-js-how-to-mock-the-imports-of-an-es6-module-20734.md>)

Original publisher: [Read original article](<https://blog.fedecarg.com/2016/07/18/node-js-how-to-mock-the-imports-of-an-es6-module/>)

Author: Federico

Published: 2016-07-18T21:58:00Z

Content type: tutorial

Language: en

Sources: [Federico Cargnelutti](<https://devfeed.tech/sources/federico-cargnelutti.md>)

Topics: [Node.js](<https://devfeed.tech/topics/node-js.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [library](<https://devfeed.tech/tags/library.md>), [node](<https://devfeed.tech/tags/node.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [programming](<https://devfeed.tech/tags/programming.md>)

## AI overview

A tutorial on using the mock-require package to mock require statements and imports in Node.js, including exported functions and standard library modules.

## Source excerpt

The package mock-require is useful if you want to mock require statements in Node.js. It has a simple API that allows you to mock anything, from a single exported function to a standard library. Here's an example: app/config.js app/services/content.js test/services/content_spec.js