betamax

Automate the copying/removing of temporary directories for your tests

betamax

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

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()
})

MIT. See LICENSE.md for details.