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

Commit

Permalink
Change the way paths are resolved in config files - now paths are
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
juliemr committed Aug 29, 2013
1 parent 5799ac5 commit a54abfb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion debugging/failure_conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.config = {
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: [
'debugging/failure_spec.js',
'failure_spec.js',
],

capabilities: {
Expand Down
2 changes: 1 addition & 1 deletion debugging/timeout_conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.config = {
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: [
'debugging/timeout_spec.js',
'timeout_spec.js',
],

capabilities: {
Expand Down
2 changes: 1 addition & 1 deletion example/protractorConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.config = {

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

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
Expand Down
9 changes: 6 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var SauceLabs = require('saucelabs');
var glob = require('glob');

var args = process.argv.slice(2);
var configDir;

// Default configuration.
var config = {
Expand Down Expand Up @@ -76,12 +77,12 @@ var run = function() {
var specs = config.specs;
var resolvedSpecs = [];
for (var i = 0; i < specs.length; ++i) {
var matches = glob.sync(specs[i]);
var matches = glob.sync(specs[i], {cwd: configDir});
if (!matches.length) {
throw new Error('Test file ' + specs[i] + ' did not match any files.');
}
for (var j = 0; j < matches.length; ++j) {
resolvedSpecs.push(matches[j]);
resolvedSpecs.push(path.join(configDir, matches[j]));
}
}
minijn.addSpecs(resolvedSpecs);
Expand Down Expand Up @@ -185,7 +186,9 @@ while(args.length) {
config.seleniumPort = args.shift();
break;
default:
config = require(path.resolve(process.cwd(), arg)).config;
var configPath = path.resolve(process.cwd(), arg);
config = require(configPath).config;
configDir = path.dirname(configPath);
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions referenceConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ exports.config = {

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

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

// ----- Options to be passed to minijasminenode -----
Expand Down
5 changes: 2 additions & 3 deletions spec/altRootConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ exports.config = {

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

// Spec patterns are relative to the current working directly when
// protractor is called.
// Spec patterns are relative to this config.
specs: [
'spec/altRoot/*_spec.js',
'altRoot/*_spec.js',
],

capabilities: {
Expand Down
5 changes: 2 additions & 3 deletions spec/basicConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ exports.config = {

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

// Spec patterns are relative to the current working directly when
// protractor is called.
// Spec patterns are relative to this directory.
specs: [
'spec/*_spec.js',
'*_spec.js',
],

capabilities: {
Expand Down

0 comments on commit a54abfb

Please sign in to comment.