Skip to content

Commit fd102a0

Browse files
committed
Exclude empty items from the array
They are empty if NODE_PATH is empty, and split() returns [''].
1 parent b7c66ac commit fd102a0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/jest-resolve/src/__tests__/resolve-test.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('findNodeModule', () => {
4646
const nodePaths = process.env.NODE_PATH
4747
? process.env.NODE_PATH
4848
.split(path.delimiter)
49+
.filter(Boolean)
4950
.map(p => path.resolve(resolvedCwd, p))
5051
: null;
5152

packages/jest-resolve/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const resolvedCwd = fs.realpathSync(process.cwd());
5555
const nodePaths = process.env.NODE_PATH
5656
? process.env.NODE_PATH
5757
.split(path.delimiter)
58+
.filter(Boolean)
5859
// The resolver expects absolute paths.
5960
.map(p => path.resolve(resolvedCwd, p))
6061
: null;

0 commit comments

Comments
 (0)