1.0.4 • Published 8 years ago

nock-back-mocha v1.0.4

Weekly downloads
14
License
ISC
Repository
github
Last release
8 years ago

nock-back-mocha

Thin wrapper around nock.back that uses different nock files for each test, and cleans up when the mocha test is done.

Arguments

  • directory - where do you want the nock files stored?

Usage

describe('Tests that make http requests', function () {
    var nockFixtureDirectory = path.resolve(__dirname, './fixtures');
    var nockBackMocha = require('nock-back-mocha')(nockFixtureDirectory);
    beforeEach(nockBackMocha.beforeEach);
    afterEach(nockBackMocha.afterEach);
    
    it('makes an http request', function (done) {
        request('http://example.com', function (err, res, body) {
            done(err);
        });
    });
});

Pro Tip: use in combination with NOCK_BACK_MODE to generate http fixtures for your tests

1.0.4

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago