Skip to content

Commit

Permalink
fix: invalid glob for nested dirs
Browse files Browse the repository at this point in the history
fixes #8201

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
  • Loading branch information
achrinza committed Jan 14, 2022
1 parent 95ef66f commit 4e9ee8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('base-artifact booter unit tests', () => {

it(`creates and sets 'glob' pattern`, async () => {
const booterInst = givenBaseBooter();
const expected = '/@(test|test2)/*@(.test.js|test2.js)';
const expected = '/{test,test2}/*@(.test.js|test2.js)';
await booterInst.configure();
expect(booterInst.glob).to.equal(expected);
});
Expand All @@ -37,7 +37,7 @@ describe('base-artifact booter unit tests', () => {
const booterInst = givenBaseBooter(
Object.assign({}, TEST_OPTIONS, {nested: true}),
);
const expected = '/@(test|test2)/**/*@(.test.js|test2.js)';
const expected = '/{test,test2}/**/*@(.test.js|test2.js)';
await booterInst.configure();
expect(booterInst.glob).to.equal(expected);
});
Expand Down
10 changes: 5 additions & 5 deletions packages/boot/src/booters/base-artifact.booter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export class BaseArtifactBooter implements Booter {
: [this.options.extensions]
: [];

const joinedDirs = this.dirs.join('|');
const joinedExts = this.extensions.join('|');
let joinedDirs = this.dirs.join(',');
if (this.dirs.length > 1) joinedDirs = `{${joinedDirs}}`;

const joinedExts = `@(${this.extensions.join('|')})`;

this.glob = this.options.glob
? this.options.glob
: `/@(${joinedDirs})/${
this.options.nested ? '**/*' : '*'
}@(${joinedExts})`;
: `/${joinedDirs}/${this.options.nested ? '**/*' : '*'}${joinedExts}`;
}

/**
Expand Down

0 comments on commit 4e9ee8d

Please sign in to comment.