mokamok

0.2.1 • Public • Published

npm version Build Status Dependencies

Mokamok

Zero configuration JavaScript Unit Testing with Mocha, Chai and Sinon

Install

$ npm install --save-dev mokamok

Getting Started

Create a directory called --tests--, and add a test file increment.spec.js:

import increment from '../increment';

describe("increment.js", () => {

    it("should increment the value", () => {
        expect(increment(7)).to.equal(8);
    });

});

Let's implement the increment.js module:

export default function (v) {
    return v + 1;
}

Modify the package.json file:

"scripts": {
    "test": "mokamok"
},

Run the test:

$ npm test

Documentation

Mokamok API

mokamok.mock(name, [mock])

Mocks the file

mokamok.unmock(name)

Stop mocking the file

Command line options


  Usage: index [options]

  Options:

    -h, --help                   output usage information
    -v, --version                output the version number
    -m, --automock               mock every module in the project automatically
    -j, --jsdom                  use jsdom
    -w, --watch                  watch for file changes
    -c, --coverage               generate a code coverage report
    -d, --test-directory <name>  test directory name
    -B, --no-babel               disable babel support

Assertions, spies, stubs and mocks

Mokamok is based on Mocha and automatically injects Chai, Sinon and sinon-chai. Optionally it makes jsdom available.

Readme

Keywords

none

Package Sidebar

Install

npm i mokamok

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • ggyorfi