mocku
ESM mocking library.
Requirements
- Node.js >= 6
esm
loader
Install
$ yarn add --dev mocku
Usage
import { mock, unmock } from 'mocku'
mock('./file', {
'./file2': {
default: 'file2'
},
fs: {
readFile: 'readFile'
}
})
import('./file')
.then(console.log)
.then(() => {
unmock('./file')
return import('./file')
})
.then(console.log)
.catch(console.error)