Comparing version 0.0.27 to 0.0.28
@@ -265,3 +265,3 @@ /*! | ||
dir = dirs.pop(), | ||
canRemove = true, | ||
deferred = false, | ||
files = fs.readdirSync(dir); | ||
@@ -275,4 +275,6 @@ | ||
if (stat.isDirectory()) { | ||
canRemove = false; | ||
dirs.push(dir); | ||
if (!deferred) { | ||
deferred = true; | ||
dirs.push(dir); | ||
} | ||
dirs.push(file); | ||
@@ -284,3 +286,3 @@ } else { | ||
if (canRemove) { | ||
if (!deferred) { | ||
fs.rmdirSync(dir); | ||
@@ -376,4 +378,4 @@ } | ||
* @param {Object} opts | ||
* @returns {Function} the callback | ||
* @api private | ||
* @returns {Function} the callback | ||
*/ | ||
@@ -380,0 +382,0 @@ function _prepareTmpDirRemoveCallback(name, opts) { |
{ | ||
"name": "tmp", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "Temporary file and directory creator", | ||
@@ -32,3 +32,3 @@ "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", | ||
"dependencies": { | ||
"os-tmpdir": "~1.0.0" | ||
"os-tmpdir": "~1.0.1" | ||
}, | ||
@@ -35,0 +35,0 @@ |
@@ -127,3 +127,3 @@ # Tmp | ||
A synchrounous version of the above. | ||
A synchronous version of the above. | ||
@@ -130,0 +130,0 @@ ```javascript |
@@ -91,3 +91,3 @@ var | ||
assert.isString(name); | ||
assert.isNotZero(name.length); | ||
assert.isNotZero(name.length, 'an empty string is not a valid name'); | ||
} | ||
@@ -122,2 +122,6 @@ | ||
function _testIssue62(cb) { | ||
_spawnTestWithoutError('issue62.js', [], cb); | ||
} | ||
function _testUnsafeCleanupSync(unsafe, cb) { | ||
@@ -127,2 +131,6 @@ _spawnTestWithoutError('unsafe-sync.js', [ 'dir', unsafe ], cb); | ||
function _testIssue62Sync(cb) { | ||
_spawnTestWithoutError('issue62-sync.js', [], cb); | ||
} | ||
module.exports.testStat = _testStat; | ||
@@ -142,3 +150,4 @@ module.exports.testPrefix = _testPrefix; | ||
module.exports.testUnsafeCleanup = _testUnsafeCleanup; | ||
module.exports.testIssue62 = _testIssue62; | ||
module.exports.testUnsafeCleanupSync = _testUnsafeCleanupSync; | ||
module.exports.testIssue62Sync = _testIssue62Sync; |
@@ -191,2 +191,14 @@ var | ||
'unsafeCleanup === true with issue62 structure': { | ||
topic: function () { | ||
Test.testIssue62Sync(this.callback); | ||
}, | ||
'should not return with an error': assert.isNull, | ||
'should return with a name': Test.assertName, | ||
'should not exist': function (err, name) { | ||
assert.ok(!existsSync(name), 'Directory should be removed'); | ||
} | ||
}, | ||
'unsafeCleanup === false': { | ||
@@ -201,2 +213,6 @@ topic: function () { | ||
_testDir(040700)({name:name}); | ||
// make sure that everything gets cleaned up | ||
fs.unlinkSync(path.join(name, 'should-be-removed.file')); | ||
fs.unlinkSync(path.join(name, 'symlinkme-target')); | ||
fs.rmdirSync(name); | ||
} | ||
@@ -203,0 +219,0 @@ }, |
@@ -185,2 +185,14 @@ var | ||
'unsafeCleanup === true with issue62 structure': { | ||
topic: function () { | ||
Test.testIssue62(this.callback); | ||
}, | ||
'should not return with an error': assert.isNull, | ||
'should return with a name': Test.assertName, | ||
'should not exist': function (err, name) { | ||
assert.ok(!existsSync(name), 'Directory should be removed'); | ||
} | ||
}, | ||
'unsafeCleanup === false': { | ||
@@ -187,0 +199,0 @@ topic: function () { |
@@ -31,2 +31,1 @@ var | ||
} | ||
Sorry, the diff of this file is not supported yet
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
55963
25
1474
11
Updatedos-tmpdir@~1.0.1