/mocku

🕶️ ESM mocking library

Primary LanguageTypeScriptMIT LicenseMIT

mocku

npm linux coverage

ESM mocking library.

Requirements

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)