1
1
import E2eCommand from 'angular-cli/commands/e2e' ;
2
2
import { CliConfig } from 'angular-cli/models/config/config' ;
3
- import { stub } from 'sinon' ;
3
+ import { stub , SinonStub } from 'sinon' ;
4
4
import { expect } from 'chai' ;
5
5
import * as proc from 'child_process' ;
6
6
7
7
const MockUI = require ( '../../helpers/mock-ui' ) ;
8
- const MockAnalytics = require ( '../../helpers/mock-analytics' ) ;
9
8
const MockProject = require ( '../../helpers/mock-project' ) ;
10
9
11
10
function createProject ( ) {
@@ -23,26 +22,29 @@ function createProject() {
23
22
}
24
23
25
24
describe ( 'e2e command' , ( ) => {
26
- let command : E2eCommand ;
25
+ let command : any ;
26
+ let exec : SinonStub ;
27
27
28
28
beforeEach ( ( ) => {
29
29
command = new E2eCommand ( {
30
30
settings : { } ,
31
31
project : createProject ( ) ,
32
32
ui : new MockUI ( ) ,
33
- analytics : new MockAnalytics ( ) ,
34
33
} ) ;
35
34
} ) ;
36
35
37
36
beforeEach ( ( ) => {
38
- stub ( proc , 'exec' ) . callsArg ( 1 ) ;
37
+ exec = stub ( proc , 'exec' ) . callsArg ( 1 ) ;
38
+ } ) ;
39
+
40
+ afterEach ( ( ) => {
41
+ exec . restore ( ) ;
39
42
} ) ;
40
43
41
44
it ( 'passes through the suite option' , ( ) => {
42
- const commandOption = '--suite=suiteA' ;
43
- return command . validateAndRun ( [ commandOption ] ) . then ( ( ) => {
44
- expect ( proc . exec . calledOnce ) . to . be . true ;
45
- expect ( proc . exec . firstCall . args [ 0 ] ) . to . have . string ( ` ${ commandOption } ` ) ;
45
+ return command . validateAndRun ( [ '--suite' , 'suiteA,suite B' ] ) . then ( ( ) => {
46
+ expect ( exec . calledOnce ) . to . be . true ;
47
+ expect ( exec . firstCall . args [ 0 ] ) . to . have . string ( ' --suite="suiteA,suite B"' ) ;
46
48
} ) ;
47
49
} ) ;
48
50
} ) ;
0 commit comments