nockturnal

0.1.1 • Public • Published

nockturnal

A simplifying recorder for nock, the HTTP request mocker for node.

nockturnal is inspired by the nock recorder described by Diana Thayer.

It simplifies the task to recording nock fixtures, optimizing to the case of pre-processing the recording before writing fixtures and post-processing them before loading them up.

This is particularly useful when one wants to prevent leakage of sensitive information like API keys, passwords and the like.

If you use other advanced features of nock, we still got you covered!

Installing

npm install nockturnal

How to use

// in test/test_file.js

// all occurances of key1 will be replace with place_holder1 in the fixtures stored.
var place_holders = {
        key1: place_holder1,
        key2: place_holder2
    },
    nockturnal = require("nockturnal")("app_name", {
        folders: {
            fixtures: "test/fixtures" // folder to find/store fixtures in
        },
        place_holders: {
            key1: place_holder1
        }
    });

describe("my_app", function(){
    before(function() {
        nockturnal.before();
    });

    // ... your regular tests

    after(function(done) {
        nockturnal.after(done);
    });
});

/nockturnal/

    Package Sidebar

    Install

    npm i nockturnal

    Weekly Downloads

    98

    Version

    0.1.1

    License

    ISC

    Last publish

    Collaborators

    • sramam