Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created November 7, 2015 23:21
Show Gist options
  • Select an option

  • Save bcomnes/9d1d773b5c66ca17ca5b to your computer and use it in GitHub Desktop.

Select an option

Save bcomnes/9d1d773b5c66ca17ca5b to your computer and use it in GitHub Desktop.
test with temp dirs
var test = require('tape')
var tmp = require('temporary-directory')
var tempDir
var cleanupTestDir
test('set up temp dir', function (t) {
tmp('bigup', function created (err, dir, cleanup) {
t.error(err, 'temp dir created without error')
cleanupTestDir = cleanup
tempDir = dir
t.end()
})
})
// test goes here
test('clean up test dir', function (t) {
cleanupTestDir(function (err) {
t.error(err, 'test dir removed without error')
t.end()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment