@@ -23,7 +23,7 @@ describe('config karma test', () => {
23
23
} ) ;
24
24
25
25
it ( 'should load the shared config' , ( done ) => {
26
- require ( '../config/karma/test.karma.conf' ) ( {
26
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
27
27
set : ( config ) => {
28
28
expect ( config . browsers ) . toBeDefined ( ) ;
29
29
expect ( called ) . toEqual ( true ) ;
@@ -34,7 +34,7 @@ describe('config karma test', () => {
34
34
35
35
it ( 'should use a custom launcher for Travis' , ( done ) => {
36
36
process . env . TRAVIS = true ;
37
- require ( '../config/karma/test.karma.conf' ) ( {
37
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
38
38
set : ( config ) => {
39
39
expect ( config . browsers [ 0 ] ) . toBe ( 'Chrome_travis_ci' ) ;
40
40
delete process . env . TRAVIS ;
@@ -48,33 +48,50 @@ describe('config karma test', () => {
48
48
headless : true
49
49
} ;
50
50
51
- require ( '../config/karma/test.karma.conf' ) ( {
51
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
52
52
set : ( config ) => {
53
53
expect ( config . browsers [ 0 ] ) . toBe ( 'ChromeHeadless' ) ;
54
54
done ( ) ;
55
55
}
56
56
} ) ;
57
57
} ) ;
58
58
59
- it ( 'should include the desktop notifications reporter if --enableDesktopNotifications flag set' , ( done ) => {
59
+ it ( 'should include the desktop notifications reporter if --enableDesktopNotifications flag set without other reporters ' , ( done ) => {
60
60
mockArgv = {
61
61
enableDesktopNotifications : true
62
62
} ;
63
63
64
- require ( '../config/karma/test.karma.conf' ) ( {
64
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
65
65
set : ( config ) => {
66
66
expect ( config . reporters ) . toContain ( 'notify' ) ;
67
67
done ( ) ;
68
68
}
69
69
} ) ;
70
70
} ) ;
71
71
72
+ it ( 'should include the desktop notifications reporter if --enableDesktopNotifications flag set with other reporters' , ( done ) => {
73
+ mockArgv = {
74
+ enableDesktopNotifications : true
75
+ } ;
76
+
77
+ mock ( path , ( config ) => {
78
+ config . reporters = [ 'custom' ] ;
79
+ } ) ;
80
+
81
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
82
+ set : ( config ) => {
83
+ expect ( config . reporters ) . toEqual ( [ 'custom' , 'notify' ] ) ;
84
+ done ( ) ;
85
+ }
86
+ } ) ;
87
+ } ) ;
88
+
72
89
it ( 'should configure the mochaReporter to ignoreSkipped if --suppressUnfocusedTestOutput flag set' , ( done ) => {
73
90
mockArgv = {
74
91
suppressUnfocusedTestOutput : true
75
92
} ;
76
93
77
- require ( '../config/karma/test.karma.conf' ) ( {
94
+ mock . reRequire ( '../config/karma/test.karma.conf' ) ( {
78
95
set : ( config ) => {
79
96
expect ( config . mochaReporter ) . toEqual ( { ignoreSkipped : true } ) ;
80
97
done ( ) ;
0 commit comments