Skip to content

Commit b5b5963

Browse files
committed
Replace glob with tinyglobby, minimatch with micromatch
This PR replaces two key dependencies to make test-exclude install size smaller and improve performance. Both replacement dependencies are reputable, popular packages used widely by other equally reputable projects (e.g. Vite). - glob was replaced with tinyglobby (install size: 3.36 MB, 158 KB respectively) - minimatch was replaced with micromatch (install size: 490 KB, 235 KB Fixes istanbuljs#51 Supersedes istanbuljs#63
1 parent 4f7f0a2 commit b5b5963

File tree

3 files changed

+107
-18
lines changed

3 files changed

+107
-18
lines changed

index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
const path = require('path');
4-
const { glob } = require('glob');
5-
const { minimatch } = require('minimatch');
4+
const { glob, globSync } = require('tinyglobby');
5+
const micromatch = require('micromatch');
66
const { defaults } = require('@istanbuljs/schema');
77
const isOutsideDir = require('./is-outside-dir');
88

@@ -95,7 +95,7 @@ class TestExclude {
9595
}
9696

9797
const dot = { dot: true };
98-
const matches = pattern => minimatch(pathToCheck, pattern, dot);
98+
const matches = pattern => micromatch.isMatch(pathToCheck, pattern, dot);
9999
return (
100100
(!this.include || this.include.some(matches)) &&
101101
(!this.exclude.some(matches) || this.excludeNegated.some(matches))
@@ -111,8 +111,7 @@ class TestExclude {
111111
globOptions.ignore = this.exclude;
112112
}
113113

114-
return glob
115-
.sync(globPatterns, globOptions)
114+
return globSync(globPatterns, globOptions)
116115
.filter(file => this.shouldInstrument(path.resolve(cwd, file)));
117116
}
118117

0 commit comments

Comments
 (0)