Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(configParser): Remove path.parse so protractor works with node < …
Browse files Browse the repository at this point in the history
…v0.12

Closes #2588
  • Loading branch information
sjelin committed Oct 8, 2015
1 parent c808741 commit 039ffa7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"

Expand All @@ -20,6 +21,8 @@ matrix:
exclude:
- env: JOB=smoke
node_js: "0.12"
- env: JOB=smoke
node_js: "0.10"


before_script:
Expand Down
20 changes: 10 additions & 10 deletions lib/configParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,23 @@ ConfigParser.resolveFilePatterns =
for (var i = 0; i < patterns.length; ++i) {
// Cucumber allows running a spec given a line number. See
// https://github.com/angular/protractor/issues/2413
var lineNumber = '';
var parsedPath = path.parse(patterns[i]);
parsedPath.base = parsedPath.base.replace(/:\d+/, function (match) {
lineNumber = match;
return '';
});

var filePath = path.format(parsedPath);
var matches = glob.sync(filePath, {cwd: cwd});
// TODO: when we deprecated node < v0.12 switch to using path.parse as in
// d6aebbad6e9b191fef141472887637ee4318438e
var fileName = patterns[i];
var lineNumber = /:\d+$/.exec(fileName);
if (lineNumber) {
fileName = fileName.slice(0, lineNumber.index);
lineNumber = lineNumber[0].slice(1);
}
var matches = glob.sync(fileName, {cwd: cwd});

if (!matches.length && !opt_omitWarnings) {
log.warn('pattern ' + patterns[i] + ' did not match any files.');
}
for (var j = 0; j < matches.length; ++j) {
var resolvedPath = path.resolve(cwd, matches[j]);
if (lineNumber) {
resolvedPath += lineNumber;
resolvedPath += ':' + lineNumber;
}
resolvedFiles.push(resolvedPath);
}
Expand Down

0 comments on commit 039ffa7

Please sign in to comment.