Skip to content

Commit 54bd159

Browse files
committed
fix: #138
1 parent 85543f4 commit 54bd159

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

src/index/generateTrees/buildGraph.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { findImports } from "../shared/findImports";
77
import { findSharedParent } from "./shared/findSharedParent";
88

99
const isFilePathIgnored = (filePath: string) => {
10-
const ignoreList = [/^\.git/];
10+
const ignoreList = [/^\.git|node_modules/];
1111

1212
return ignoreList.some(re => re.test(filePath));
1313
};

tests/__snapshots__/end-to-end.test.ts.snap

+41
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,26 @@ exports[`end-to-end --avoid-single-file globals: globals/src/index.js 1`] = `
437437
"
438438
`;
439439
440+
exports[`end-to-end --avoid-single-file ignore-node-modules 1`] = `
441+
"ignore-node-modules
442+
├── file2.js
443+
├── index.js
444+
└── node_modules
445+
├── add.js
446+
└── subtract.js"
447+
`;
448+
449+
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/file2.js 1`] = `""`;
450+
451+
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/index.js 1`] = `"require('./file2')"`;
452+
453+
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/node_modules/add.js 1`] = `
454+
"require('./subtract')
455+
"
456+
`;
457+
458+
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/node_modules/subtract.js 1`] = `""`;
459+
440460
exports[`end-to-end --avoid-single-file index-cycle 1`] = `
441461
"index-cycle
442462
├── index
@@ -1075,6 +1095,27 @@ export const five = 5;
10751095
"
10761096
`;
10771097
1098+
exports[`end-to-end ignore-node-modules 1`] = `
1099+
"ignore-node-modules
1100+
├── index
1101+
│ └── file2.js
1102+
├── index.js
1103+
└── node_modules
1104+
├── add.js
1105+
└── subtract.js"
1106+
`;
1107+
1108+
exports[`end-to-end ignore-node-modules: ignore-node-modules/index.js 1`] = `"require('./index/file2')"`;
1109+
1110+
exports[`end-to-end ignore-node-modules: ignore-node-modules/index/file2.js 1`] = `""`;
1111+
1112+
exports[`end-to-end ignore-node-modules: ignore-node-modules/node_modules/add.js 1`] = `
1113+
"require('./subtract')
1114+
"
1115+
`;
1116+
1117+
exports[`end-to-end ignore-node-modules: ignore-node-modules/node_modules/subtract.js 1`] = `""`;
1118+
10781119
exports[`end-to-end index-cycle 1`] = `
10791120
"index-cycle
10801121
├── index

tests/fixtures/ignore-node-modules/file2.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./file2')

0 commit comments

Comments
 (0)