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

Commit a54abfb

Browse files
committed
Change the way paths are resolved in config files - now paths are
resolved relative to the location of the config file as opposed to the working directory when the code is called. This is consistent with other test runners are just makes more sense.
1 parent 5799ac5 commit a54abfb

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

debugging/failure_conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports.config = {
77
// Spec patterns are relative to the current working directly when
88
// protractor is called.
99
specs: [
10-
'debugging/failure_spec.js',
10+
'failure_spec.js',
1111
],
1212

1313
capabilities: {

debugging/timeout_conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports.config = {
77
// Spec patterns are relative to the current working directly when
88
// protractor is called.
99
specs: [
10-
'debugging/timeout_spec.js',
10+
'timeout_spec.js',
1111
],
1212

1313
capabilities: {

example/protractorConf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports.config = {
1010

1111
// Spec patterns are relative to the current working directly when
1212
// protractor is called.
13-
specs: ['example/onProtractorRunner.js'],
13+
specs: ['onProtractorRunner.js'],
1414

1515
// Options to be passed to Jasmine-node.
1616
jasmineNodeOpts: {

lib/cli.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var SauceLabs = require('saucelabs');
99
var glob = require('glob');
1010

1111
var args = process.argv.slice(2);
12+
var configDir;
1213

1314
// Default configuration.
1415
var config = {
@@ -76,12 +77,12 @@ var run = function() {
7677
var specs = config.specs;
7778
var resolvedSpecs = [];
7879
for (var i = 0; i < specs.length; ++i) {
79-
var matches = glob.sync(specs[i]);
80+
var matches = glob.sync(specs[i], {cwd: configDir});
8081
if (!matches.length) {
8182
throw new Error('Test file ' + specs[i] + ' did not match any files.');
8283
}
8384
for (var j = 0; j < matches.length; ++j) {
84-
resolvedSpecs.push(matches[j]);
85+
resolvedSpecs.push(path.join(configDir, matches[j]));
8586
}
8687
}
8788
minijn.addSpecs(resolvedSpecs);
@@ -185,7 +186,9 @@ while(args.length) {
185186
config.seleniumPort = args.shift();
186187
break;
187188
default:
188-
config = require(path.resolve(process.cwd(), arg)).config;
189+
var configPath = path.resolve(process.cwd(), arg);
190+
config = require(configPath).config;
191+
configDir = path.dirname(configPath);
189192
break;
190193
}
191194
}

referenceConf.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ exports.config = {
3535

3636
// ----- What tests to run -----
3737
//
38-
// Spec patterns are relative to the current working directly when
39-
// protractor is called.
38+
// Spec patterns are relative to the location of this config.
4039
specs: [
4140
'spec/*_spec.js',
4241
],
@@ -56,7 +55,7 @@ exports.config = {
5655
baseUrl: 'http://localhost:8000',
5756

5857
// Selector for the element housing the angular app - this defaults to
59-
// body, but is necessary if ng-app is on a descendant of <body>
58+
// body, but is necessary if ng-app is on a descendant of <body>
6059
rootElement: 'body',
6160

6261
// ----- Options to be passed to minijasminenode -----

spec/altRootConf.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ exports.config = {
55

66
seleniumAddress: 'http://localhost:4444/wd/hub',
77

8-
// Spec patterns are relative to the current working directly when
9-
// protractor is called.
8+
// Spec patterns are relative to this config.
109
specs: [
11-
'spec/altRoot/*_spec.js',
10+
'altRoot/*_spec.js',
1211
],
1312

1413
capabilities: {

spec/basicConf.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ exports.config = {
55

66
seleniumAddress: 'http://localhost:4444/wd/hub',
77

8-
// Spec patterns are relative to the current working directly when
9-
// protractor is called.
8+
// Spec patterns are relative to this directory.
109
specs: [
11-
'spec/*_spec.js',
10+
'*_spec.js',
1211
],
1312

1413
capabilities: {

0 commit comments

Comments
 (0)