test-fixture
Copy test-fixtures to temp dir and get resolved file paths.
Why?
I am tired of writing
path.resolve(__dirname, 'test', 'fixtures')
,tmp.dir(callback)
,fse.copy(fixtures, dir)
path.join(fixtures, 'file-a.js')
EVERY DAY!
So, I got this.
Install
$ npm install test-fixture --save
Usage
var fixtures = require('test-fixture');
var f = fixtures();
f.copy(function(err, dir){
f.resolve('a.js');
f.dest('a.js');
});
fixtures(path...)
Arguments | Dir of test fixtures |
---|
undefined | test/fixtures |
'a' | test/fixtures/a |
'a' , 'b' | test/fixtures/a/b |
'/path/to' (absolute) | /path/to |
'/path/to' (absolute), 'a' | /path/to/a |
.copy(callback)
- callback
function(err, dir)
- err
Error
- dir
path
the temporary directory for testing
Copy the test fixtures into a temporary directory.
.resolve(path...)
Resolves the paths to get the path of the test fixtures
.dest(path...)
Resolves the paths to get the path of the copied test fixtures
If .copy()
is not ready, it will returns null
Licence
MIT