isolated

isolated provider one-time folders for unit tests.

npm install isolated
2 downloads in the last week
4 downloads in the last month

isolated

isolated provider one-time folders for unit tests.

Installation

$ npm install isolated

Quick Start

Using isolated is easy. All you need to do is to add a reference to it within your Node.js application:

var isolated = require('isolated');

Then you can use it within your tests. In its simplest form, isolated provides a one-time folder for your test and guarantees to clean up later.

test('...', function (done) {
  isolated(function (err, directory) {
    // ...
  });
});

Additionally, you may want to specify a file or a directory that isolated shall copy to the one-time directory before running your test.

test('...', function (done) {
  isolated('foo.txt', function (err, directory) {
    // ...
  });
});

If you need to copy multiple files or directories, specify an array instead of a single item.

Then you can use it within your tests. In its simplest form, isolated provides a one-time folder for your test and guarantees to clean up later.

test('...', function (done) {
  isolated([ 'foo.txt', 'bar.txt' ], function (err, directory) {
    // ...
  });
});

Running the tests

isolated has been developed using TDD. To run the tests, go to the folder where you have installed isolated to and run npm test. You need to have mocha installed.

$ npm test

Additionally, this module can be built using Grunt. Besides running the tests, Grunt also analyses the code using JSHint. To run Grunt, go to the folder where you have installed isolated and run grunt. You need to have grunt-cli installed.

$ grunt
npm loves you