test-fixture
Advanced tools
Comparing version 1.0.0 to 1.0.1
28
index.js
@@ -52,10 +52,13 @@ 'use strict'; | ||
Fixtures.prototype.copy = function(callback) { | ||
Fixtures.prototype.copy = function( /* [to], callback */ ) { | ||
var self = this; | ||
tmp.dir(function (err, dir) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (arguments.length == 2) { | ||
var dir = arguments[0]; | ||
var callback = arguments[1]; | ||
} else { | ||
var callback = arguments[0]; | ||
} | ||
fse.copy(self.path, dir, function (err) { | ||
function copydir(dir) { | ||
fse.copy(self.path, dir, function(err) { | ||
if (err) { | ||
@@ -68,3 +71,14 @@ return callback(err); | ||
}); | ||
}); | ||
} | ||
if (dir) { | ||
copydir(dir); | ||
} else { | ||
tmp.dir(function(err, dir) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
copydir(dir); | ||
}); | ||
} | ||
}; |
{ | ||
"name": "test-fixture", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Copy test-fixtures to temp dir and get resolved file paths.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -69,2 +69,15 @@ 'use strict'; | ||
}); | ||
it("to specified folder", function(done){ | ||
var f = fixtures(); | ||
f.copy(node_path.join(__dirname,'temp'), function(err,dir){ | ||
done(); | ||
if (err) { | ||
return; | ||
} | ||
expect_file(f.path, dir, 'a.js'); | ||
expect_file(f.path, dir, 'c'); | ||
}); | ||
}); | ||
}); | ||
@@ -71,0 +84,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9532
176