Skip to content

Commit

Permalink
fix: #138
Browse files Browse the repository at this point in the history
  • Loading branch information
benawad committed Aug 19, 2020
1 parent 85543f4 commit 54bd159
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index/generateTrees/buildGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { findImports } from "../shared/findImports";
import { findSharedParent } from "./shared/findSharedParent";

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

return ignoreList.some(re => re.test(filePath));
};
Expand Down
41 changes: 41 additions & 0 deletions tests/__snapshots__/end-to-end.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,26 @@ exports[`end-to-end --avoid-single-file globals: globals/src/index.js 1`] = `
"
`;
exports[`end-to-end --avoid-single-file ignore-node-modules 1`] = `
"ignore-node-modules
├── file2.js
├── index.js
└── node_modules
├── add.js
└── subtract.js"
`;
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/file2.js 1`] = `""`;
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/index.js 1`] = `"require('./file2')"`;
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/node_modules/add.js 1`] = `
"require('./subtract')
"
`;
exports[`end-to-end --avoid-single-file ignore-node-modules: ignore-node-modules/node_modules/subtract.js 1`] = `""`;
exports[`end-to-end --avoid-single-file index-cycle 1`] = `
"index-cycle
├── index
Expand Down Expand Up @@ -1075,6 +1095,27 @@ export const five = 5;
"
`;
exports[`end-to-end ignore-node-modules 1`] = `
"ignore-node-modules
├── index
│ └── file2.js
├── index.js
└── node_modules
├── add.js
└── subtract.js"
`;
exports[`end-to-end ignore-node-modules: ignore-node-modules/index.js 1`] = `"require('./index/file2')"`;
exports[`end-to-end ignore-node-modules: ignore-node-modules/index/file2.js 1`] = `""`;
exports[`end-to-end ignore-node-modules: ignore-node-modules/node_modules/add.js 1`] = `
"require('./subtract')
"
`;
exports[`end-to-end ignore-node-modules: ignore-node-modules/node_modules/subtract.js 1`] = `""`;
exports[`end-to-end index-cycle 1`] = `
"index-cycle
├── index
Expand Down
Empty file.
1 change: 1 addition & 0 deletions tests/fixtures/ignore-node-modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./file2')

0 comments on commit 54bd159

Please sign in to comment.