@@ -19,62 +19,61 @@ describe('basic serve usage', () => {
1919
2020 const isWindows = process . platform === 'win32' ;
2121
22+ // TODO fix me on windows
2223 if ( isWindows ) {
23- // TODO fix me on windows
24- it ( 'compiles without flags' , ( ) => {
24+ it ( 'TODO: Fix on windows' , ( ) => {
2525 expect ( true ) . toBe ( true ) ;
26-
27- console . warn ( 'TODO: fix `serve` test on windows' ) ;
28- } ) ;
29- } else {
30- it ( 'should respect the --no-color flag' , async ( ) => {
31- const { stdout, stderr } = await runServe ( [ '--help' , '--no-color' ] , __dirname ) ;
32- options . enabled = true ;
33- expect ( stdout ) . not . toContain ( yellow ( usageText ) ) ;
34- expect ( stdout ) . toContain ( descriptionText ) ;
35- expect ( stderr ) . toHaveLength ( 0 ) ;
3626 } ) ;
27+ return ;
28+ }
3729
38- it ( 'should not invoke info subcommand' , async ( ) => {
39- const { stdout, stderr } = await runServe ( [ '--client-log-level' , 'info' ] , testPath ) ;
40- expect ( stdout ) . toContain ( 'main.js' ) ;
41- expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
42- expect ( stderr ) . toHaveLength ( 0 ) ;
43- } ) ;
30+ it ( 'should respect the --no-color flag' , async ( ) => {
31+ const { stdout, stderr } = await runServe ( [ '--help' , '--no-color' ] , __dirname ) ;
32+ options . enabled = true ;
33+ expect ( stdout ) . not . toContain ( yellow ( usageText ) ) ;
34+ expect ( stdout ) . toContain ( descriptionText ) ;
35+ expect ( stderr ) . toHaveLength ( 0 ) ;
36+ } ) ;
4437
45- it ( 'compiles without flags ' , async ( ) => {
46- const { stdout, stderr } = await runServe ( [ '--port ' , port ] , testPath ) ;
47- expect ( stdout ) . toContain ( 'main.js' ) ;
48- expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
49- expect ( stderr ) . toHaveLength ( 0 ) ;
50- } ) ;
38+ it ( 'should not invoke info subcommand ' , async ( ) => {
39+ const { stdout, stderr } = await runServe ( [ '--client-log-level ' , 'info' ] , testPath ) ;
40+ expect ( stdout ) . toContain ( 'main.js' ) ;
41+ expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
42+ expect ( stderr ) . toHaveLength ( 0 ) ;
43+ } ) ;
5144
52- it ( 'uses hot flag to alter bundle ' , async ( ) => {
53- const { stdout, stderr } = await runServe ( [ '--port' , port , '--hot' ] , testPath ) ;
54- expect ( stdout ) . toContain ( 'main.js' ) ;
55- expect ( stdout ) . toContain ( 'hot/dev-server.js' ) ;
56- expect ( stderr ) . toHaveLength ( 0 ) ;
57- } ) ;
45+ it ( 'compiles without flags ' , async ( ) => {
46+ const { stdout, stderr } = await runServe ( [ '--port' , port ] , testPath ) ;
47+ expect ( stdout ) . toContain ( 'main.js' ) ;
48+ expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
49+ expect ( stderr ) . toHaveLength ( 0 ) ;
50+ } ) ;
5851
59- it ( 'uses no- hot flag' , async ( ) => {
60- const { stdout, stderr } = await runServe ( [ '--port' , port , '--no -hot' ] , testPath ) ;
61- expect ( stdout ) . toContain ( 'main.js' ) ;
62- expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
63- expect ( stderr ) . toHaveLength ( 0 ) ;
64- } ) ;
52+ it ( 'uses hot flag to alter bundle ' , async ( ) => {
53+ const { stdout, stderr } = await runServe ( [ '--port' , port , '--hot' ] , testPath ) ;
54+ expect ( stdout ) . toContain ( 'main.js' ) ;
55+ expect ( stdout ) . toContain ( 'hot/dev-server.js' ) ;
56+ expect ( stderr ) . toHaveLength ( 0 ) ;
57+ } ) ;
6558
66- it ( 'uses hot flag and progress flag' , async ( ) => {
67- const { stdout, stderr } = await runServe ( [ '--port' , port , '--hot' , '--progress' ] , testPath ) ;
68- expect ( stdout ) . toContain ( 'main.js' ) ;
69- expect ( stdout ) . toContain ( 'hot/dev-server.js' ) ;
70- // progress flag makes use of stderr
71- expect ( stderr ) . not . toHaveLength ( 0 ) ;
72- } ) ;
59+ it ( 'uses no-hot flag' , async ( ) => {
60+ const { stdout, stderr } = await runServe ( [ '--port' , port , '--no-hot' ] , testPath ) ;
61+ expect ( stdout ) . toContain ( 'main.js' ) ;
62+ expect ( stdout ) . not . toContain ( 'hot/dev-server.js' ) ;
63+ expect ( stderr ) . toHaveLength ( 0 ) ;
64+ } ) ;
7365
74- it ( 'throws error on unknown flag' , async ( ) => {
75- const { stdout, stderr } = await runServe ( [ '--port' , port , '--unknown-flag' ] , testPath ) ;
76- expect ( stdout ) . toHaveLength ( 0 ) ;
77- expect ( stderr ) . toContain ( 'Unknown argument: --unknown-flag' ) ;
78- } ) ;
79- }
66+ it ( 'uses hot flag and progress flag' , async ( ) => {
67+ const { stdout, stderr } = await runServe ( [ '--port' , port , '--hot' , '--progress' ] , testPath ) ;
68+ expect ( stdout ) . toContain ( 'main.js' ) ;
69+ expect ( stdout ) . toContain ( 'hot/dev-server.js' ) ;
70+ // progress flag makes use of stderr
71+ expect ( stderr ) . not . toHaveLength ( 0 ) ;
72+ } ) ;
73+
74+ it ( 'throws error on unknown flag' , async ( ) => {
75+ const { stdout, stderr } = await runServe ( [ '--port' , port , '--unknown-flag' ] , testPath ) ;
76+ expect ( stdout ) . toHaveLength ( 0 ) ;
77+ expect ( stderr ) . toContain ( 'Unknown argument: --unknown-flag' ) ;
78+ } ) ;
8079} ) ;
0 commit comments