1
- const { bootstrap, getOutputProduction } = require ( '../../utils' ) ;
1
+ const {
2
+ bootstrap,
3
+ getOutputDevelopment,
4
+ getOutputProduction,
5
+ } = require ( '../../utils' ) ;
2
6
const fs = require ( 'fs-extra' ) ;
3
7
const path = require ( 'path' ) ;
4
8
const Semaphore = require ( 'async-sema' ) ;
@@ -19,7 +23,7 @@ describe('webpack message formatting', () => {
19
23
semaphore . release ( ) ;
20
24
} ) ;
21
25
22
- xit ( 'formats babel syntax error' , async ( ) => {
26
+ it ( 'formats babel syntax error' , async ( ) => {
23
27
fs . copySync (
24
28
path . join ( __dirname , 'src' , 'AppBabel.js' ) ,
25
29
path . join ( testDirectory , 'src' , 'App.js' )
@@ -29,8 +33,7 @@ describe('webpack message formatting', () => {
29
33
expect ( response ) . toMatchSnapshot ( ) ;
30
34
} ) ;
31
35
32
- xit ( 'formats css syntax error' , async ( ) => {
33
- // TODO: fix me!
36
+ it ( 'formats css syntax error' , async ( ) => {
34
37
fs . copySync (
35
38
path . join ( __dirname , 'src' , 'AppCss.js' ) ,
36
39
path . join ( testDirectory , 'src' , 'App.js' )
@@ -40,8 +43,7 @@ describe('webpack message formatting', () => {
40
43
expect ( response ) . toMatchSnapshot ( ) ;
41
44
} ) ;
42
45
43
- xit ( 'formats unknown export' , async ( ) => {
44
- // TODO: fix me!
46
+ it ( 'formats unknown export' , async ( ) => {
45
47
fs . copySync (
46
48
path . join ( __dirname , 'src' , 'AppUnknownExport.js' ) ,
47
49
path . join ( testDirectory , 'src' , 'App.js' )
@@ -51,8 +53,27 @@ describe('webpack message formatting', () => {
51
53
expect ( response ) . toMatchSnapshot ( ) ;
52
54
} ) ;
53
55
54
- xit ( 'formats missing package' , async ( ) => {
55
- // TODO: fix me!
56
+ it ( 'formats aliased unknown export' , async ( ) => {
57
+ fs . copySync (
58
+ path . join ( __dirname , 'src' , 'AppAliasUnknownExport.js' ) ,
59
+ path . join ( testDirectory , 'src' , 'App.js' )
60
+ ) ;
61
+
62
+ const response = await getOutputProduction ( { directory : testDirectory } ) ;
63
+ expect ( response ) . toMatchSnapshot ( ) ;
64
+ } ) ;
65
+
66
+ it ( 'formats no default export' , async ( ) => {
67
+ fs . copySync (
68
+ path . join ( __dirname , 'src' , 'AppNoDefault.js' ) ,
69
+ path . join ( testDirectory , 'src' , 'App.js' )
70
+ ) ;
71
+
72
+ const response = await getOutputProduction ( { directory : testDirectory } ) ;
73
+ expect ( response ) . toMatchSnapshot ( ) ;
74
+ } ) ;
75
+
76
+ it ( 'formats missing package' , async ( ) => {
56
77
fs . copySync (
57
78
path . join ( __dirname , 'src' , 'AppMissingPackage.js' ) ,
58
79
path . join ( testDirectory , 'src' , 'App.js' )
@@ -85,4 +106,52 @@ describe('webpack message formatting', () => {
85
106
const response = await getOutputProduction ( { directory : testDirectory } ) ;
86
107
expect ( response ) . toMatchSnapshot ( ) ;
87
108
} ) ;
109
+
110
+ it ( 'helps when users tries to use sass' , async ( ) => {
111
+ fs . copySync (
112
+ path . join ( __dirname , 'src' , 'AppSass.js' ) ,
113
+ path . join ( testDirectory , 'src' , 'App.js' )
114
+ ) ;
115
+
116
+ const response = await getOutputProduction ( { directory : testDirectory } ) ;
117
+ expect ( response ) . toMatchSnapshot ( ) ;
118
+ } ) ;
119
+
120
+ it ( 'formats file not found error' , async ( ) => {
121
+ fs . copySync (
122
+ path . join ( __dirname , 'src' , 'AppUnknownFile.js' ) ,
123
+ path . join ( testDirectory , 'src' , 'App.js' )
124
+ ) ;
125
+
126
+ const response = await getOutputProduction ( { directory : testDirectory } ) ;
127
+ expect ( response ) . toMatchSnapshot ( ) ;
128
+ } ) ;
129
+
130
+ it ( 'formats case sensitive path error' , async ( ) => {
131
+ fs . copySync (
132
+ path . join ( __dirname , 'src' , 'AppIncorrectCase.js' ) ,
133
+ path . join ( testDirectory , 'src' , 'App.js' )
134
+ ) ;
135
+
136
+ const response = await getOutputDevelopment ( { directory : testDirectory } ) ;
137
+ if ( process . platform === 'darwin' ) {
138
+ expect ( response . stderr ) . toMatch (
139
+ `Cannot find file: 'export5.js' does not match the corresponding name on disk: './src/Export5.js'.`
140
+ ) ;
141
+ } else {
142
+ expect ( response . stderr ) . not . toEqual ( '' ) ; // TODO: figure out how we can test this on Linux/Windows
143
+ // I believe getting this working requires we tap into enhanced-resolve
144
+ // pipeline, which is debt we don't want to take on right now.
145
+ }
146
+ } ) ;
147
+
148
+ it ( 'formats out of scope error' , async ( ) => {
149
+ fs . copySync (
150
+ path . join ( __dirname , 'src' , 'AppOutOfScopeImport.js' ) ,
151
+ path . join ( testDirectory , 'src' , 'App.js' )
152
+ ) ;
153
+
154
+ const response = await getOutputProduction ( { directory : testDirectory } ) ;
155
+ expect ( response ) . toMatchSnapshot ( ) ;
156
+ } ) ;
88
157
} ) ;
0 commit comments