Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update sanitizeSpecsPattern logic
  • Loading branch information
pranavj1001 committed Mar 5, 2024
commit 7e1ffac7b700ebfb645d92ddca12b2913370ccaa
2 changes: 1 addition & 1 deletion bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
};

exports.sanitizeSpecsPattern = (pattern) => {
return pattern && pattern.split(",").length > 1 ? "{" + pattern + "}" : pattern;
return pattern && !(pattern.includes("{") && pattern.includes("}")) && pattern.split(",").length > 1 ? "{" + pattern + "}" : pattern;
}

exports.generateUniqueHash = () => {
Expand Down
4 changes: 4 additions & 0 deletions test/unit/bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,10 @@ describe('utils', () => {
expect(utils.sanitizeSpecsPattern('pattern3')).to.eq('pattern3');
});

it('should not wrap pattern around {} when input already has {}', () => {
expect(utils.sanitizeSpecsPattern('pattern/{folderA,folderB}/*.spec.ts')).to.eq('pattern/{folderA,folderB}/*.spec.ts');
});

it('should return undefined when --spec is undefined', () => {
expect(utils.sanitizeSpecsPattern(undefined)).to.eq(undefined);
});
Expand Down