watcher - understand more patterns as full excludes

This commit is contained in:
Benjamin Pasero
2021-10-11 14:35:58 +02:00
parent 690de80fbd
commit 8d7bb23720
2 changed files with 16 additions and 2 deletions
@@ -73,6 +73,8 @@ export class ParcelWatcherService extends Disposable implements IWatcherService
private static readonly GLOB_MARKERS = {
Star: '*',
GlobStar: '**',
GlobStarPosix: '**/**',
GlobStarWindows: '**\\**',
GlobStarPathStartPosix: '**/',
GlobStarPathEndPosix: '/**',
StarPathEndPosix: '/*',
@@ -166,8 +168,12 @@ export class ParcelWatcherService extends Disposable implements IWatcherService
let normalizedExclude: string | undefined = undefined;
if (isGlob) {
// Examples: **
if (exclude === ParcelWatcherService.GLOB_MARKERS.GlobStar) {
// Examples: **, **/**, **\**
if (
exclude === ParcelWatcherService.GLOB_MARKERS.GlobStar ||
exclude === ParcelWatcherService.GLOB_MARKERS.GlobStarPosix ||
exclude === ParcelWatcherService.GLOB_MARKERS.GlobStarWindows
) {
normalizedExclude = path;
}
@@ -504,6 +504,14 @@ flakySuite('Recursive Watcher (parcel)', () => {
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);
excludes = service.toExcludePaths(testDir, ['**/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);
excludes = service.toExcludePaths(testDir, ['**\\**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);
excludes = service.toExcludePaths(testDir, ['**/node_modules/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));