@@ -84,20 +84,28 @@ describe('Baumeister with default options', () => {
84
84
] ) ;
85
85
} ) ;
86
86
87
- it ( 'should have `useHandlebars` set to `true` in baumeister.json' , ( ) => {
88
- assert . fileContent ( 'baumeister.json' , / " u s e H a n d l e b a r s " : t r u e , / ) ;
87
+ it ( 'should have `useHandlebars` set to `true` in Baumeister settings' , ( ) => {
88
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
89
+ packageJson . should . have
90
+ . propertyByPath ( 'baumeister' , 'useHandlebars' )
91
+ . eql ( true ) ;
89
92
} ) ;
90
93
91
- it ( 'should have `generateBanners` set to `false` in baumeister.json' , ( ) => {
92
- assert . fileContent ( 'baumeister.json' , / " g e n e r a t e B a n n e r s " : f a l s e , / ) ;
94
+ it ( 'should have `generateBanners` set to `false` in Baumeister settings' , ( ) => {
95
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
96
+ packageJson . should . have
97
+ . propertyByPath ( 'baumeister' , 'generateBanners' )
98
+ . eql ( false ) ;
93
99
} ) ;
94
100
95
- it ( 'should have the default ProvidePlugin settings in baumeister.json' , ( ) => {
96
- assert . fileContent ( [
97
- [ 'baumeister.json' , / " P r o v i d e P l u g i n " : { \n / ] ,
98
- [ 'baumeister.json' , / " \$ " : " j q u e r y " , / ] ,
99
- [ 'baumeister.json' , / " j Q u e r y " : " j q u e r y " / ]
100
- ] ) ;
101
+ it ( 'should have the default ProvidePlugin settings in Baumeister settings' , ( ) => {
102
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
103
+ packageJson . should . have
104
+ . propertyByPath ( 'baumeister' , 'webpack' , 'ProvidePlugin' )
105
+ . eql ( {
106
+ $ : 'jquery' ,
107
+ jQuery : 'jquery'
108
+ } ) ;
101
109
} ) ;
102
110
103
111
it ( 'should create package manager files' , ( ) => {
@@ -113,26 +121,22 @@ describe('Baumeister with default options', () => {
113
121
'.editorconfig' ,
114
122
'.gitattributes' ,
115
123
'.gitignore' ,
116
- '.babelrc' ,
117
- 'src/app/.babelrc' ,
118
- '.travis.yml' ,
119
- '.eslintrc.json' ,
120
- '.stylelintrc.json'
124
+ '.travis.yml'
121
125
] ) ;
122
126
} ) ;
123
127
124
- it ( 'should not have React related plugins in .babelrc ' , ( ) => {
128
+ it ( 'should not have React related plugins in Babel settings ' , ( ) => {
125
129
assert . noFileContent ( [
126
- [ 'src/app/.babelrc ' , / p l u g i n - p r o p o s a l - c l a s s - p r o p e r t i e s / ] ,
127
- [ 'src/app/.babelrc ' , / p l u g i n - t r a n s f o r m - r e a c t - j s x / ]
130
+ [ 'package.json ' , / p l u g i n - p r o p o s a l - c l a s s - p r o p e r t i e s / ] ,
131
+ [ 'package.json ' , / p l u g i n - t r a n s f o r m - r e a c t - j s x / ]
128
132
] ) ;
129
133
} ) ;
130
134
131
- it ( 'should not have React related settings in .eslintrc ' , ( ) => {
135
+ it ( 'should not have React related settings in ESLint config ' , ( ) => {
132
136
assert . noFileContent ( [
133
- [ '.eslintrc .json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
134
- [ '.eslintrc .json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
135
- [ '.eslintrc .json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
137
+ [ 'package .json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
138
+ [ 'package .json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
139
+ [ 'package .json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
136
140
] ) ;
137
141
} ) ;
138
142
@@ -163,7 +167,6 @@ describe('Baumeister with default options', () => {
163
167
it ( 'should create other project files' , ( ) => {
164
168
assert . file ( [
165
169
'README.md' ,
166
- 'baumeister.json' ,
167
170
'postcss.config.js' ,
168
171
'humans.txt' ,
169
172
'LICENSE' ,
@@ -257,11 +260,10 @@ describe('Baumeister with default options', () => {
257
260
} ) ;
258
261
259
262
it ( 'should not have React and related dependencies' , ( ) => {
260
- assert . noFileContent ( [
261
- [ 'package.json' , / r e a c t / ] ,
262
- [ 'package.json' , / r e a c t - d o m / ] ,
263
- [ 'package.json' , / p r o p - t y p e s / ]
264
- ] ) ;
263
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
264
+ packageJson . should . not . have . propertyByPath ( 'dependencies' , 'react' ) ;
265
+ packageJson . should . not . have . propertyByPath ( 'dependencies' , 'react-dom' ) ;
266
+ packageJson . should . not . have . propertyByPath ( 'dependencies' , 'prop-types' ) ;
265
267
} ) ;
266
268
267
269
it ( 'should not have React related dev dependencies' , ( ) => {
@@ -331,7 +333,7 @@ describe('Baumeister with default options', () => {
331
333
332
334
it ( 'should have the current year within the LICENSE' , ( ) => {
333
335
const regex = new RegExp (
334
- escapeStringRegexp ( new Date ( ) . getFullYear ( ) + '' ) ,
336
+ escapeStringRegexp ( String ( new Date ( ) . getFullYear ( ) ) ) ,
335
337
''
336
338
) ; // eslint-disable-line no-implicit-coercion
337
339
assert . fileContent ( 'LICENSE' , regex ) ;
@@ -417,11 +419,14 @@ describe('Baumeister generating a single page app', () => {
417
419
) ;
418
420
} ) ;
419
421
420
- it ( 'should have adapted settings in baumeister.json' , ( ) => {
421
- assert . fileContent ( [
422
- [ 'baumeister.json' , / " u s e H a n d l e b a r s " : f a l s e , / ] ,
423
- [ 'baumeister.json' , / " P r o v i d e P l u g i n " : { } / ]
424
- ] ) ;
422
+ it ( 'should have adapted settings in Baumeister settings' , ( ) => {
423
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
424
+ packageJson . should . have
425
+ . propertyByPath ( 'baumeister' , 'useHandlebars' )
426
+ . eql ( false ) ;
427
+ packageJson . should . have
428
+ . propertyByPath ( 'baumeister' , 'webpack' , 'ProvidePlugin' )
429
+ . eql ( { } ) ;
425
430
} ) ;
426
431
427
432
it ( 'should create no Handlebars related files' , ( ) => {
@@ -470,18 +475,18 @@ describe('Baumeister generating a single page app', () => {
470
475
} ) ;
471
476
} ) ;
472
477
473
- it ( 'should have React related plugins in .babelrc ' , ( ) => {
478
+ it ( 'should have React related plugins in Babel settings ' , ( ) => {
474
479
assert . fileContent ( [
475
- [ 'src/app/.babelrc ' , / p l u g i n - p r o p o s a l - c l a s s - p r o p e r t i e s / ] ,
476
- [ 'src/app/.babelrc ' , / p l u g i n - t r a n s f o r m - r e a c t - j s x / ]
480
+ [ 'package.json ' , / p l u g i n - p r o p o s a l - c l a s s - p r o p e r t i e s / ] ,
481
+ [ 'package.json ' , / p l u g i n - t r a n s f o r m - r e a c t - j s x / ]
477
482
] ) ;
478
483
} ) ;
479
484
480
- it ( 'should have React related settings in .eslintrc ' , ( ) => {
485
+ it ( 'should have React related settings in ESLint config ' , ( ) => {
481
486
assert . fileContent ( [
482
- [ '.eslintrc .json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
483
- [ '.eslintrc .json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
484
- [ '.eslintrc. json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
487
+ [ 'package .json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
488
+ [ 'package .json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
489
+ [ 'package. json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
485
490
] ) ;
486
491
} ) ;
487
492
@@ -541,8 +546,11 @@ describe('Baumeister with banner', () => {
541
546
) ;
542
547
} ) ;
543
548
544
- it ( 'should have `generateBanners` set to `true` in baumeister.json' , ( ) => {
545
- assert . fileContent ( 'baumeister.json' , / " g e n e r a t e B a n n e r s " : t r u e , / ) ;
549
+ it ( 'should have `generateBanners` set to `true` in Baumeister settings' , ( ) => {
550
+ const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
551
+ packageJson . should . have
552
+ . propertyByPath ( 'baumeister' , 'generateBanners' )
553
+ . eql ( true ) ;
546
554
} ) ;
547
555
} ) ;
548
556
@@ -598,7 +606,7 @@ describe('Baumeister without an open source license', () => {
598
606
599
607
it ( 'should have the current year within the LICENSE' , ( ) => {
600
608
const regex = new RegExp (
601
- escapeStringRegexp ( new Date ( ) . getFullYear ( ) + '' ) ,
609
+ escapeStringRegexp ( String ( new Date ( ) . getFullYear ( ) ) ) ,
602
610
''
603
611
) ; // eslint-disable-line no-implicit-coercion
604
612
assert . fileContent ( 'LICENSE' , regex ) ;
@@ -674,7 +682,7 @@ describe('Baumeister with Apache License, Version 2.0', () => {
674
682
675
683
it ( 'should have the current year within the LICENSE' , ( ) => {
676
684
const regex = new RegExp (
677
- escapeStringRegexp ( new Date ( ) . getFullYear ( ) + '' ) ,
685
+ escapeStringRegexp ( String ( new Date ( ) . getFullYear ( ) ) ) ,
678
686
''
679
687
) ; // eslint-disable-line no-implicit-coercion
680
688
assert . fileContent ( 'LICENSE' , regex ) ;
@@ -747,7 +755,7 @@ describe('Baumeister with GNU General Public License', () => {
747
755
748
756
it ( 'should have the current year within the LICENSE' , ( ) => {
749
757
const regex = new RegExp (
750
- escapeStringRegexp ( new Date ( ) . getFullYear ( ) + '' ) ,
758
+ escapeStringRegexp ( String ( new Date ( ) . getFullYear ( ) ) ) ,
751
759
''
752
760
) ; // eslint-disable-line no-implicit-coercion
753
761
assert . fileContent ( 'LICENSE' , regex ) ;
@@ -1013,12 +1021,7 @@ describe('Baumeister using --yo-rc flag', () => {
1013
1021
} ) ;
1014
1022
1015
1023
it ( 'should create dot files' , ( ) => {
1016
- assert . file ( [
1017
- '.editorconfig' ,
1018
- '.gitattributes' ,
1019
- '.gitignore' ,
1020
- '.eslintrc.json'
1021
- ] ) ;
1024
+ assert . file ( [ '.editorconfig' , '.gitattributes' , '.gitignore' ] ) ;
1022
1025
} ) ;
1023
1026
1024
1027
it ( 'should have `/dist` directory in .gitignore' , ( ) => {
@@ -1183,7 +1186,7 @@ describe('Baumeister using --yo-rc flag', () => {
1183
1186
1184
1187
it ( 'should have the current year within the LICENSE' , ( ) => {
1185
1188
const regex = new RegExp (
1186
- escapeStringRegexp ( new Date ( ) . getFullYear ( ) + '' ) ,
1189
+ escapeStringRegexp ( String ( new Date ( ) . getFullYear ( ) ) ) ,
1187
1190
''
1188
1191
) ; // eslint-disable-line no-implicit-coercion
1189
1192
assert . fileContent ( 'LICENSE' , regex ) ;
0 commit comments