betamax

Automate the copying/removing of temporary directories for your tests

npm install betamax
2 downloads in the last month

betamax Flattr this!experimental

Automate the copying/removing of temporary directories for your tape tests.

Usage

betamax

betamax(directory[, test])

Where directory is the directory you want to copy to a temporary folder for each test. Returns a test decorator that will handle creating and removing the temporary directories as required:

var betamax = require('betamax')
var test = require('tape')

var basic = betamax(
  __diraname + '/fixtures/basic'
)

test('basic', basic(function(t) {
  // The temporary directory is set
  // as a property on `t`:
  var directory = t.directory

  t.end()
}))

You might find it simpler to supply betamax with tape's test function, which will give you back a modified version to construct your tests with:

var betamax = require('betamax')
var tape = require('tape')

var test = betamax(
  __dirname + '/fixtures/basic'
, tape)


// You can pass tape's `test` method into
// betamax to use it directly:
test('basic', function(t) {
  var directory = t.directory
  // test things here...
  t.end()
})

License

MIT. See LICENSE.md for details.

npm loves you