Skip to content

Commit

Permalink
fix(cli): support double quote and backtick as well
Browse files Browse the repository at this point in the history
  • Loading branch information
desmondgc committed Jan 12, 2025
1 parent 1a96d88 commit 344fe29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cli/src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ const tests: Test[] = [
},
},
{
test: 'should crawl a single folder with single quote',
test: 'should crawl folders with quotes',
options: {
pathsToCrawl: ["/photo's/"],
pathsToCrawl: ["/photo's/", '/photo"s/', '/photo`s/'],
},
files: {
"/photo's/image.jpg": true,
"/photo's/image1.jpg": true,
'/photo"s/image2.jpg': true,
'/photo`s/image3.jpg': true,
},
skipOnWin32: true, // single quote interferes with mockfs root on Windows
},
Expand Down
2 changes: 1 addition & 1 deletion cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const crawl = async (options: CrawlOptions): Promise<string[]> => {
}

const searchPatterns = patterns.map((pattern) => {
let escapedPattern = pattern.replaceAll("'", "[']");
let escapedPattern = pattern.replaceAll("'", "[']").replaceAll('"', '["]').replaceAll('`', '[`]');
if (recursive) {
escapedPattern = escapedPattern + '/**';
}
Expand Down

0 comments on commit 344fe29

Please sign in to comment.