@@ -9,65 +9,94 @@ var cli = require(path.resolve(pkg.bin)).default;
99describe ( "E2E CLI `reload` with no files arg" , function ( ) {
1010 it ( "should make a http request to the protocol with no files arg" , function ( done ) {
1111 browserSync . reset ( ) ;
12+ var scheduler = require ( "../../utils" ) . getScheduler ( ) ;
1213 browserSync
1314 . create ( )
14- . init ( { server : "test/fixtures" , open : false } , function ( err , bs ) {
15- var spy = sinon . spy ( bs . events , "emit" ) ;
15+ . init (
16+ {
17+ server : "test/fixtures" ,
18+ open : false ,
19+ debug : { scheduler : scheduler }
20+ } ,
21+ function ( err , bs ) {
22+ var spy = sinon . spy ( bs . events , "emit" ) ;
1623
17- cli ( {
18- cli : {
19- input : [ "reload" ] ,
20- flags : {
21- port : bs . options . get ( "port" )
24+ cli ( {
25+ cli : {
26+ input : [ "reload" ] ,
27+ flags : {
28+ port : bs . options . get ( "port" )
29+ }
30+ } ,
31+ cb : function ( ) {
32+ scheduler . advanceTo ( 600 ) ;
33+ sinon . assert . calledWithExactly (
34+ spy ,
35+ "browser:reload"
36+ ) ;
37+ bs . cleanup ( ) ;
38+ done ( ) ;
2239 }
23- } ,
24- cb : function ( ) {
25- sinon . assert . calledWithExactly ( spy , "browser:reload" ) ;
26- bs . cleanup ( ) ;
27- done ( ) ;
28- }
29- } ) ;
30- } ) ;
40+ } ) ;
41+ }
42+ ) ;
3143 } ) ;
3244
3345 it ( "should make a http request with files arg" , function ( done ) {
3446 browserSync . reset ( ) ;
35-
47+ var scheduler = require ( "../../utils" ) . getScheduler ( ) ;
3648 browserSync
3749 . create ( )
38- . init ( { server : "test/fixtures" , open : false } , function ( err , bs ) {
39- var spy = sinon . spy ( bs . events , "emit" ) ;
50+ . init (
51+ {
52+ server : "test/fixtures" ,
53+ open : false ,
54+ debug : { scheduler : scheduler }
55+ } ,
56+ function ( err , bs ) {
57+ var spy = sinon . spy ( bs . events , "emit" ) ;
4058
41- cli ( {
42- cli : {
43- input : [ "reload" ] ,
44- flags : {
45- port : bs . options . get ( "port" ) ,
46- files : "core.css"
59+ cli ( {
60+ cli : {
61+ input : [ "reload" ] ,
62+ flags : {
63+ port : bs . options . get ( "port" ) ,
64+ files : "core.css"
65+ }
66+ } ,
67+ cb : function ( ) {
68+ scheduler . advanceTo ( 600 ) ;
69+ sinon . assert . calledWithExactly (
70+ spy ,
71+ "file:changed" ,
72+ {
73+ path : "core.css" ,
74+ basename : "core.css" ,
75+ log : true ,
76+ namespace : "core" ,
77+ event : "change" ,
78+ ext : "css"
79+ }
80+ ) ;
81+ bs . cleanup ( ) ;
82+ done ( ) ;
4783 }
48- } ,
49- cb : function ( ) {
50- sinon . assert . calledWithExactly ( spy , "file:changed" , {
51- path : "core.css" ,
52- basename : "core.css" ,
53- log : true ,
54- namespace : "core" ,
55- event : "change" ,
56- ext : "css"
57- } ) ;
58- bs . cleanup ( ) ;
59- done ( ) ;
60- }
61- } ) ;
62- } ) ;
84+ } ) ;
85+ }
86+ ) ;
6387 } ) ;
6488 it ( "should make a http request with files arg over HTTPS" , function ( done ) {
6589 browserSync . reset ( ) ;
66-
90+ var scheduler = require ( "../../utils" ) . getScheduler ( ) ;
6791 browserSync
6892 . create ( )
6993 . init (
70- { server : "test/fixtures" , open : false , https : true } ,
94+ {
95+ server : "test/fixtures" ,
96+ open : false ,
97+ https : true ,
98+ debug : { scheduler : scheduler }
99+ } ,
71100 function ( err , bs ) {
72101 var spy = sinon . spy ( bs . events , "emit" ) ;
73102
@@ -80,6 +109,7 @@ describe("E2E CLI `reload` with no files arg", function() {
80109 }
81110 } ,
82111 cb : function ( ) {
112+ scheduler . advanceTo ( 600 ) ;
83113 sinon . assert . calledWithExactly (
84114 spy ,
85115 "file:changed" ,
0 commit comments