@@ -23,8 +23,7 @@ const beforeLoad = (prompts) => {
23
23
'skip-welcome-message' : true ,
24
24
'skip-install' : true
25
25
} )
26
- . withPrompts
27
- ( prompts )
26
+ . withPrompts ( prompts )
28
27
. on ( 'ready' , function ( instance ) {
29
28
generator = instance ;
30
29
} )
@@ -61,6 +60,12 @@ describe('react-webpack:app', () => {
61
60
} ) ;
62
61
} ) ;
63
62
63
+ describe ( 'configuring' , ( ) => {
64
+ it ( 'should add css module support' , ( ) => {
65
+ assert . fileContent ( 'package.json' , 'react-css-modules' ) ;
66
+ } ) ;
67
+ } ) ;
68
+
64
69
describe ( '#createFiles' , ( ) => {
65
70
66
71
it ( 'should generate dot files' , ( ) => {
@@ -120,6 +125,44 @@ describe('react-webpack:app', () => {
120
125
} ) ;
121
126
} ) ;
122
127
128
+ describe ( 'react-webpack:app without cssmodules support' , ( ) => {
129
+
130
+ let prompts = { } ;
131
+ for ( let p of defaultPrompts ) {
132
+ prompts [ p . name ] = p . default ;
133
+ }
134
+ prompts . cssmodules = false ;
135
+
136
+ before ( ( ) => {
137
+ return beforeLoad ( prompts ) ;
138
+ } ) ;
139
+
140
+ describe ( '#config' , ( ) => {
141
+
142
+ it ( 'should set the generatedWith key to the current generator major version' , ( ) => {
143
+ expect ( generator . config . get ( 'generatedWithVersion' ) ) . to . equal ( 4 ) ;
144
+ } ) ;
145
+
146
+ it ( 'should use "css" as default style language' , ( ) => {
147
+ expect ( generator . config . get ( 'style' ) ) . to . equal ( 'css' ) ;
148
+ } ) ;
149
+
150
+ it ( 'should not use "css modules"' , ( ) => {
151
+ expect ( generator . config . get ( 'cssmodules' ) ) . to . be . false ;
152
+ } ) ;
153
+
154
+ it ( 'should not enable "PostCSS" by default' , ( ) => {
155
+ expect ( generator . config . get ( 'postcss' ) ) . to . be . false ;
156
+ } ) ;
157
+ } ) ;
158
+
159
+ describe ( 'configuring' , ( ) => {
160
+ it ( 'should add no cssmodule support' , ( ) => {
161
+ assert . noFileContent ( 'package.json' , 'react-css-modules' ) ;
162
+ } ) ;
163
+ } ) ;
164
+ } ) ;
165
+
123
166
describe ( 'react-webpack:app with PostCSS support' , ( ) => {
124
167
125
168
let prompts = { } ;
0 commit comments