Skip to content

Commit 04c4bfe

Browse files
committed
Fixed handling of special Glob syntax in project base dirs
e.g. /some/path/[something]/ Fixes #206
1 parent e7f5fbd commit 04c4bfe

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/runner_base.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -463,29 +463,28 @@ function addFiles(kind) {
463463
file = file.substring(1);
464464
}
465465

466-
if (!path.isAbsolute(file)) {
467-
// Don't use path.join because it will convert slashes to backslashes
468-
// on Windows, and glob interprets backslashes as escape sequences.
469-
file = [
470-
this.projectBaseDir,
471-
this.specDir,
472-
file
473-
].join('/');
474-
}
475-
476466
return {
477467
includeFiles: ongoing.includeFiles.concat(!hasNegation ? [file] : []),
478468
excludeFiles: ongoing.excludeFiles.concat(hasNegation ? [file] : [])
479469
};
480470
}, { includeFiles: [], excludeFiles: [] });
481471

472+
const baseDir = `${this.projectBaseDir}/${this.specDir}`;
473+
482474
includeFiles.forEach(function(file) {
483475
const filePaths = glob
484-
.sync(file, { ignore: excludeFiles })
476+
.sync(file, { cwd: baseDir, ignore: excludeFiles })
477+
.map(function(f) {
478+
if (path.isAbsolute(f)) {
479+
return f;
480+
} else {
481+
return unWindows(path.join(baseDir, f));
482+
}
483+
})
485484
.filter(function(filePath) {
486485
return fileArr.indexOf(filePath) === -1;
487486
})
488-
// Sort file paths to match the behavior of Glob <9.
487+
// Sort file paths consistently. Glob <9 did this but Glob >= 9 doesn't.
489488
// Jasmine doesn't care about the order, but users might.
490489
.sort();
491490

0 commit comments

Comments
 (0)