jspm-mock
The "jspm-mock" module swaps any jspm module with a fake alternative. Essential for mocking dependencies in unit tests.
Installation
jspm install npm:jspm-mock --dev
- Note: This package assumes that you already have a working copy of jspm installed.
Usage
Import inside jspm environment (i.e. specs):
Mock using functions:
jspmMock// same as...// jspmMock.mock('fs', function () {// default: function () {// console.log("Testing FAKE function!")// }// })jspmMock
Mock using objects:
jspmMockjspmMock
Mock using raw sources:
jspmMockjspmMock
Unmock when the time is right:
jspmMock