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

fix(configParser): Remove path.parse so protractor works with node < … #2591

Merged
merged 1 commit into from
Oct 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is no longer excluding smoke jobs with nodejs 0.12 :(

That's not the end of the world - can we try it with:

exclude:
  - env: JOB-smoke
    node_js: "0.12"
  - env: JOB-smoke
    node_js "0.10"

- 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