@@ -90,43 +90,50 @@ describe('build', () => {
90
90
] ) ;
91
91
} ) ;
92
92
93
- describe ( "babel config file resolution" , ( ) => {
94
- const findBabelLoaderRule = rules => rules . find ( rule => rule . use . loader . includes ( "babel-loader" ) ) ;
93
+ describe ( 'babel config file resolution' , ( ) => {
94
+ const findBabelLoaderRule = ( rules ) =>
95
+ rules . find ( ( rule ) => rule . use . loader . includes ( 'babel-loader' ) ) ;
95
96
96
- it ( " should alter the default babelOpts when no valid babel config file is found" , async ( ) => {
97
- setupFunction ( "" , " not-babel.config.js" ) ;
97
+ it ( ' should alter the default babelOpts when no valid babel config file is found' , async ( ) => {
98
+ setupFunction ( '' , ' not-babel.config.js' ) ;
98
99
99
100
const stats = await build . run ( functions ) ;
100
- const babelLoaderRuleOptions = findBabelLoaderRule ( stats . compilation . options . module . rules ) . use . options ;
101
+ const babelLoaderRuleOptions = findBabelLoaderRule (
102
+ stats . compilation . options . module . rules ,
103
+ ) . use . options ;
101
104
102
105
expect ( babelLoaderRuleOptions . presets ) . toBeDefined ( ) ;
103
106
expect ( babelLoaderRuleOptions . plugins ) . toBeDefined ( ) ;
104
107
} ) ;
105
108
106
- it ( " should not alter the default babelOpts when a valid babel config file is found in same directory as the functions directory" , async ( ) => {
107
- setupFunction ( "" , " babel.config.js" ) ;
109
+ it ( ' should not alter the default babelOpts when a valid babel config file is found in same directory as the functions directory' , async ( ) => {
110
+ setupFunction ( '' , ' babel.config.js' ) ;
108
111
109
112
const stats = await build . run ( functions ) ;
110
- const babelLoaderRuleOptions = findBabelLoaderRule ( stats . compilation . options . module . rules ) . use . options ;
113
+ const babelLoaderRuleOptions = findBabelLoaderRule (
114
+ stats . compilation . options . module . rules ,
115
+ ) . use . options ;
111
116
112
117
expect ( babelLoaderRuleOptions . presets ) . toBeUndefined ( ) ;
113
118
expect ( babelLoaderRuleOptions . plugins ) . toBeUndefined ( ) ;
114
119
} ) ;
115
120
116
- it ( " should not alter the default babelOpts when a valid babel config is found in directory above the functions directory" , async ( ) => {
117
- setupFunction ( "" , " babel.config.js" ) ;
121
+ it ( ' should not alter the default babelOpts when a valid babel config is found in directory above the functions directory' , async ( ) => {
122
+ setupFunction ( '' , ' babel.config.js' ) ;
118
123
119
- const functionsSubDir = path . join ( functions , " subdir" ) ;
124
+ const functionsSubDir = path . join ( functions , ' subdir' ) ;
120
125
121
126
fs . mkdirSync ( functionsSubDir ) ;
122
- fs . writeFileSync ( path . join ( functionsSubDir , " index.js" ) , "" ) ;
127
+ fs . writeFileSync ( path . join ( functionsSubDir , ' index.js' ) , '' ) ;
123
128
124
129
const stats = await build . run ( functionsSubDir ) ;
125
- const babelLoaderRuleOptions = findBabelLoaderRule ( stats . compilation . options . module . rules ) . use . options ;
130
+ const babelLoaderRuleOptions = findBabelLoaderRule (
131
+ stats . compilation . options . module . rules ,
132
+ ) . use . options ;
126
133
127
134
expect ( babelLoaderRuleOptions . presets ) . toBeUndefined ( ) ;
128
135
expect ( babelLoaderRuleOptions . plugins ) . toBeUndefined ( ) ;
129
136
} ) ;
130
- } )
137
+ } ) ;
131
138
} ) ;
132
139
} ) ;
0 commit comments