doraemon

0.2.1 • Public • Published

Doraemon

Build Status

A module API data mock tool.

You can use Doraemon to mock unfinished module api data.

Install

npm install doraemon

Usage

define module

// ./moduleA.js
module.exports = {
    say: function(what) {
    }
};

add module

var D = require("doraemon")({
    mock: true,
    dataPath: "./__MOCKS__/",
    q: true
});

// add module
D.add("moduleA", require("moduleA"));

// require module
D.require("moduleA").say()
.then(function(data) {
    console.log(data); // ouput "hello, world!"
})
.fail(function(e) {
    //
}); 

mock file

./MOCKS/moduleA.say.js

module.exports = exports = "hello, world!";

Readme

Keywords

none

Package Sidebar

Install

npm i doraemon

Weekly Downloads

1

Version

0.2.1

License

MIT

Last publish

Collaborators

  • 4simple