fs-jetpack
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -0,1 +1,5 @@ | ||
# 2.2.1 (2019-01-20) | ||
- `find()` no longer crashes on ENOENT (e.g. when one of the files has been deleted by other process). | ||
- Added check if a parameter `newName` passed to `rename()` isn't a path. | ||
# 2.2.0 (2018-10-13) | ||
@@ -2,0 +6,0 @@ - Added ignoreCase option to `find()` and `copy()` methods. |
@@ -86,3 +86,3 @@ "use strict"; | ||
(itemPath, item) => { | ||
if (itemPath !== path && matchesAnyOfGlobs(itemPath)) { | ||
if (item && itemPath !== path && matchesAnyOfGlobs(itemPath)) { | ||
if ( | ||
@@ -140,3 +140,8 @@ (item.type === "file" && options.files === true) || | ||
const data = walker.read(); | ||
if (data && data.path !== path && matchesAnyOfGlobs(data.path)) { | ||
if ( | ||
data && | ||
data.item && | ||
data.path !== path && | ||
matchesAnyOfGlobs(data.path) | ||
) { | ||
const item = data.item; | ||
@@ -143,0 +148,0 @@ if ( |
@@ -11,2 +11,8 @@ "use strict"; | ||
validate.argument(methodSignature, "newName", newName, ["string"]); | ||
if (pathUtil.basename(newName) !== newName) { | ||
throw new Error( | ||
`Argument "newName" passed to ${methodSignature} should be a filename, not a path. Received "${newName}"` | ||
); | ||
} | ||
}; | ||
@@ -13,0 +19,0 @@ |
{ | ||
"name": "fs-jetpack", | ||
"description": "Better file system API", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"author": "Jakub Szwacz <jakub@szwacz.com>", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -0,1 +1,2 @@ | ||
import * as pathUtil from "path"; | ||
import * as fse from "fs-extra"; | ||
@@ -113,15 +114,32 @@ import { expect } from "chai"; | ||
describe('"newName" argument', () => { | ||
tests.forEach(test => { | ||
it(test.type, () => { | ||
expect(() => { | ||
test.method("abc", undefined); | ||
}).to.throw( | ||
`Argument "newName" passed to ${ | ||
test.methodName | ||
}(path, newName) must be a string. Received undefined` | ||
); | ||
describe("type check", () => { | ||
tests.forEach(test => { | ||
it(test.type, () => { | ||
expect(() => { | ||
test.method("abc", undefined); | ||
}).to.throw( | ||
`Argument "newName" passed to ${ | ||
test.methodName | ||
}(path, newName) must be a string. Received undefined` | ||
); | ||
}); | ||
}); | ||
}); | ||
describe("shouldn't be path, just a filename", () => { | ||
const pathToTest = pathUtil.join("new-name", "with-a-slash"); | ||
tests.forEach(test => { | ||
it(test.type, () => { | ||
expect(() => { | ||
test.method("abc", pathToTest); | ||
}).to.throw( | ||
`Argument "newName" passed to ${ | ||
test.methodName | ||
}(path, newName) should be a filename, not a path. Received "${pathToTest}"` | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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
276224
8083