JSPM

component-mocker

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q32185F
  • License BSD

Let you mock objects easily

Package Exports

  • component-mocker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (component-mocker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

component-mocker

This package provides functionality for mocking objects easily (including functions and classes). It has been extracted from jest. You can find detailed documentation in the index.js file. The LICENSE and PATENTS files are copies from the jest project.

Example usage

var mocker = require('component-mocker');
var myModule = ...; // Your module that you want to mock
var myModuleMetadata = mocker.getMetadata(myModule);
var myModuleMock = mocker.generateFromMetadata(myModuleMetadata);

In browser usage

You can also use the index.js script in the browser. The module is then available on the global scope under the name mocker. You can also run it in no conflict mode by calling var mocker = mocker.noConflict().