directory-fixture-provider
Advanced tools
Comparing version 1.1.13 to 1.2.0
@@ -17,12 +17,24 @@ 'use strict'; | ||
var tmpSubFolder = 'directory-fixture-provider-destination'; | ||
var unlimitedCurry = require('unlimited-curry'); | ||
module.exports = exports = function exports(fixturesRoot) { | ||
module.exports = exports = unlimitedCurry(function (e, parameters) { | ||
var fixturesRoot = parameters.data.returnArray[0]; | ||
var commands = parameters.getFrom(1, parameters.data); | ||
var isPermanent = parameters.command.has('permanent'); | ||
var permanentParam = isPermanent ? parameters.command.getArguments('permanent')[0][0] : false; | ||
module.fixturesRoot = fixturesRoot; | ||
module._destinationDirecoryRoot = path.join(tmpDir, tmpSubFolder, randomstring.generate({ | ||
length: 12, | ||
charset: 'alphabetic' | ||
})); | ||
if (!isPermanent) { | ||
module._destinationDirecoryRoot = path.join(tmpDir, tmpSubFolder, randomstring.generate({ | ||
length: 12, | ||
charset: 'alphabetic' | ||
})); | ||
} | ||
if (isPermanent) { | ||
module._destinationDirecoryRoot = path.join(tmpDir, tmpSubFolder, fixturesRoot); | ||
} | ||
return { | ||
@@ -37,3 +49,3 @@ tmpSubFolder: tmpSubFolder, | ||
if (emptyDir(fixturePath)) { | ||
throw String('Please put some files to the ' + fixturePath + ' directory,\nyou might not want to test with no files right?\n '); | ||
throw String('Please put some files to the ' + fixturePath + ' directory,\nyou might not want to test with no files right?'); | ||
} | ||
@@ -45,2 +57,6 @@ | ||
mkdirp(dir); | ||
if (permanentParam === 'overwrite') { | ||
fsExtra.emptyDirSync(dir); | ||
} | ||
fsExtra.copySync(fixturePath, dir); | ||
@@ -129,3 +145,3 @@ | ||
}; | ||
}; | ||
}); | ||
@@ -132,0 +148,0 @@ module.getFixturePath = function () { |
{ | ||
"name": "directory-fixture-provider", | ||
"version": "1.1.13", | ||
"version": "1.2.0", | ||
"description": "Provides directories for testing.", | ||
@@ -49,3 +49,4 @@ "main": "dist/src/index.js", | ||
"randomstring": "^1.1.5", | ||
"recursive-readdir-sync": "^1.0.6" | ||
"recursive-readdir-sync": "^1.0.6", | ||
"unlimited-curry": "^1.2.0" | ||
}, | ||
@@ -52,0 +53,0 @@ "devDependencies": { |
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
12454
158
10
+ Addedunlimited-curry@^1.2.0
+ Addedunlimited-curry@1.4.13(transitive)