Skip to content

Commit 0a0c0d8

Browse files
committed
feat(spec): add spec argument to the protractor config, allows to filter tests to run
Closes angular#695
1 parent f54f4e8 commit 0a0c0d8

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ to the preprocessor and run the tests without exiting karma
6262
4. `protractor protractor-dart2js.conf.js`: Dart2JS e2e tests
6363

6464
Angular specific command line options when running protractor:
65-
`protractor protractor-{js|dart2js}-conf.js --ng-help`
65+
- `protractor protractor-{js|dart2js}-conf.js --ng-help`
6666

6767
### Performance tests
6868

protractor-shared.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var argv = require('yargs')
1010
type: 'boolean'
1111
},
1212
'force-gc': {
13-
describe: 'force gc',
13+
describe: 'force gc.',
1414
default: false,
1515
type: 'boolean'
1616
},
@@ -19,8 +19,12 @@ var argv = require('yargs')
1919
default: false
2020
},
2121
'browsers': {
22-
describe: 'preconfigured browsers that should be used',
22+
describe: 'comma separated list of preconfigured browsers to use',
2323
default: 'ChromeDesktop'
24+
},
25+
'spec': {
26+
describe: 'comma separated file patterns to test',
27+
default: false
2428
}
2529
})
2630
.help('ng-help')
@@ -95,6 +99,21 @@ var BROWSER_CAPS = {
9599
}
96100
};
97101

102+
var getBenchmarkFiles = function (benchmark, spec) {
103+
var specFiles = [];
104+
var perfFiles = [];
105+
if (spec.length) {
106+
spec.split(',').forEach(function (name) {
107+
specFiles.push('dist/js/cjs/**/e2e_test/' + name)
108+
perfFiles.push('dist/js/cjs/**/e2e_test/' + name)
109+
});
110+
} else {
111+
specFiles.push('dist/js/cjs/**/e2e_test/**/*_spec.js');
112+
perfFiles.push('dist/js/cjs/**/e2e_test/**/*_perf.js');
113+
}
114+
return benchmark ? perfFiles : specFiles.concat(perfFiles);
115+
};
116+
98117
var config = exports.config = {
99118
// Disable waiting for Angular as we don't have an integration layer yet...
100119
// TODO(tbosch): Implement a proper debugging API for Ng2.0, remove this here
@@ -110,12 +129,7 @@ var config = exports.config = {
110129
}
111130
},
112131

113-
specs: argv['benchmark'] ? [
114-
'dist/js/cjs/**/e2e_test/**/*_perf.js'
115-
] : [
116-
'dist/js/cjs/**/e2e_test/**/*_spec.js',
117-
'dist/js/cjs/**/e2e_test/**/*_perf.js'
118-
],
132+
specs: getBenchmarkFiles(argv['benchmark'], argv['spec']),
119133

120134
exclude: [
121135
'dist/js/cjs/**/node_modules/**',

0 commit comments

Comments
 (0)