Skip to content

Commit 7e1ffac

Browse files
committed
update sanitizeSpecsPattern logic
1 parent 7a8ef57 commit 7e1ffac

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bin/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
11631163
};
11641164

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

11691169
exports.generateUniqueHash = () => {

test/unit/bin/helpers/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,10 @@ describe('utils', () => {
27212721
expect(utils.sanitizeSpecsPattern('pattern3')).to.eq('pattern3');
27222722
});
27232723

2724+
it('should not wrap pattern around {} when input already has {}', () => {
2725+
expect(utils.sanitizeSpecsPattern('pattern/{folderA,folderB}/*.spec.ts')).to.eq('pattern/{folderA,folderB}/*.spec.ts');
2726+
});
2727+
27242728
it('should return undefined when --spec is undefined', () => {
27252729
expect(utils.sanitizeSpecsPattern(undefined)).to.eq(undefined);
27262730
});

0 commit comments

Comments
 (0)