This repository was archived by the owner on Jul 29, 2024. It is now read-only.
File tree 3 files changed +22
-3
lines changed
3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -265,8 +265,13 @@ exports.config = {
265
265
showColors : true ,
266
266
// Default time to wait in ms before a test fails.
267
267
defaultTimeoutInterval : 30000 ,
268
- // Function called to print jasmine results
268
+ // Function called to print jasmine results.
269
269
print : function ( ) { } ,
270
+ // If set, only execute specs whose names match the pattern, which is
271
+ // internally compiled to a RegExp.
272
+ grep : 'pattern' ,
273
+ // Inverts 'grep' matches
274
+ invertGrep : false
270
275
} ,
271
276
272
277
// Options to be passed to Mocha.
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ var optimist = require('optimist').
59
59
alias ( 'build' , 'capabilities.build' ) .
60
60
alias ( 'verbose' , 'jasmineNodeOpts.isVerbose' ) .
61
61
alias ( 'stackTrace' , 'jasmineNodeOpts.includeStackTrace' ) .
62
+ alias ( 'grep' , 'jasmineNodeOpts.grep' ) .
63
+ alias ( 'invert-grep' , 'jasmineNodeOpts.invertGrep' ) .
62
64
string ( 'capabilities.tunnel-identifier' ) .
63
65
check ( function ( arg ) {
64
66
if ( arg . _ . length > 1 ) {
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ exports.run = function(runner, specs) {
54
54
55
55
require ( 'jasminewd2' ) ;
56
56
57
+ var jasmineNodeOpts = runner . getConfig ( ) . jasmineNodeOpts ;
58
+
57
59
// On timeout, the flow should be reset. This will prevent webdriver tasks
58
60
// from overflowing into the next test and causing it to fail or timeout
59
61
// as well. This is done in the reporter instead of an afterEach block
@@ -62,10 +64,20 @@ exports.run = function(runner, specs) {
62
64
var reporter = new RunnerReporter ( runner ) ;
63
65
jasmine . getEnv ( ) . addReporter ( reporter ) ;
64
66
67
+ // Filter specs to run based on jasmineNodeOpts.grep and jasmineNodeOpts.invert.
68
+ jasmine . getEnv ( ) . specFilter = function ( spec ) {
69
+ var grepMatch = ! jasmineNodeOpts ||
70
+ ! jasmineNodeOpts . grep ||
71
+ spec . getFullName ( ) . match ( new RegExp ( jasmineNodeOpts . grep ) ) != null ;
72
+ var invertGrep = ! ! ( jasmineNodeOpts && jasmineNodeOpts . invertGrep ) ;
73
+ if ( grepMatch == invertGrep ) {
74
+ spec . pend ( ) ;
75
+ }
76
+ return true ;
77
+ }
78
+
65
79
return runner . runTestPreparer ( ) . then ( function ( ) {
66
80
return q . promise ( function ( resolve , reject ) {
67
- var jasmineNodeOpts = runner . getConfig ( ) . jasmineNodeOpts ;
68
-
69
81
if ( jasmineNodeOpts && jasmineNodeOpts . defaultTimeoutInterval ) {
70
82
jasmine . DEFAULT_TIMEOUT_INTERVAL = jasmineNodeOpts . defaultTimeoutInterval ;
71
83
}
You can’t perform that action at this time.
0 commit comments