@@ -8,9 +8,50 @@ const PLUGIN_NAME = 'gulp-casper-js';
8
8
function casper ( options ) {
9
9
options = options || { } ;
10
10
11
- var cmd = ( typeof options . command === 'undefined' ) ? 'test' : options . command ;
11
+ var args = [ ] ;
12
+
13
+ if ( options . xunit ) {
14
+ args . push ( '--xunit=' + options . xunit ) ;
15
+ }
16
+
17
+ if ( options . logLevel ) {
18
+ args . push ( '--log-level=' + options . loglevel ) ;
19
+ }
20
+
21
+ if ( options . engine ) {
22
+ args . push ( '--engine=' + options . engine ) ;
23
+ }
24
+
25
+ if ( options . includes ) {
26
+ args . push ( '--includes=' + options . includes ) ;
27
+ }
28
+
29
+ if ( options . pre ) {
30
+ args . push ( '--pre=' + options . pre ) ;
31
+ }
32
+
33
+ if ( options . post ) {
34
+ args . push ( '--post=' + options . post ) ;
35
+ }
36
+
37
+ if ( options . failfast ) {
38
+ args . push ( '--fail-fast=' ) ;
39
+ }
40
+
41
+ if ( options . concise ) {
42
+ args . push ( '--concise=' ) ;
43
+ }
44
+
45
+ if ( options . nocolors ) {
46
+ args . push ( '--no-colors' ) ;
47
+ }
48
+
49
+ if ( options . websecurity ) {
50
+ args . push ( '--web-security=' + options . websecurity ) ;
51
+ }
12
52
13
53
var binPath = ( typeof options . binPath === 'undefined' ) ? 'casperjs' : options . binPath ;
54
+ var cmd = ( typeof options . command === 'undefined' ) ? 'test' : options . command ;
14
55
15
56
var files = [ ] ;
16
57
@@ -36,8 +77,13 @@ function casper(options) {
36
77
37
78
var end = function ( cb ) {
38
79
cmd = cmd ? ( Array . isArray ( cmd ) ? cmd : cmd . split ( ' ' ) ) : [ ] ;
80
+ var tempArr = cmd . concat ( files ) ;
81
+
82
+ if ( args . length ) {
83
+ tempArr = tempArr . concat ( args ) ;
84
+ }
39
85
40
- var casperChild = spawn ( binPath , cmd . concat ( files ) ) ;
86
+ var casperChild = spawn ( 'casperjs' , tempArr ) ;
41
87
42
88
casperChild . stdout . on ( 'data' , function ( data ) {
43
89
var msg = data . toString ( ) . slice ( 0 , - 1 ) ;
0 commit comments