Skip to content

Commit a84c96f

Browse files
novemberbornsindresorhus
authored andcommitted
Share glob caches (#1661)
1 parent b6fa8b9 commit a84c96f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lib/ava-files.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,33 +122,31 @@ class AvaFiles {
122122
this.files = files;
123123
this.sources = options.sources || [];
124124
this.cwd = options.cwd || process.cwd();
125+
this.globCaches = {
126+
cache: Object.create(null),
127+
statCache: Object.create(null),
128+
realpathCache: Object.create(null),
129+
symlinks: Object.create(null)
130+
};
125131

126132
autoBind(this);
127133
}
128134

129135
findTestFiles() {
130-
return handlePaths(this.files, this.excludePatterns, {
136+
return handlePaths(this.files, this.excludePatterns, Object.assign({
131137
cwd: this.cwd,
132-
cache: Object.create(null),
133-
statCache: Object.create(null),
134-
realpathCache: Object.create(null),
135-
symlinks: Object.create(null),
136138
expandDirectories: false,
137139
nodir: false
138-
});
140+
}, this.globCaches));
139141
}
140142

141143
findTestHelpers() {
142-
return handlePaths(defaultHelperPatterns(), ['!**/node_modules/**'], {
144+
return handlePaths(defaultHelperPatterns(), ['!**/node_modules/**'], Object.assign({
143145
cwd: this.cwd,
144146
includeUnderscoredFiles: true,
145-
cache: Object.create(null),
146-
statCache: Object.create(null),
147-
realpathCache: Object.create(null),
148-
symlinks: Object.create(null),
149147
expandDirectories: false,
150148
nodir: false
151-
});
149+
}, this.globCaches));
152150
}
153151

154152
isSource(filePath) {

0 commit comments

Comments
 (0)