File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -126,9 +126,9 @@ describe('js-to-styles-vars-loader', () => {
126
126
const [ moduleData , stylesContent ] = operator . divideContent ( content ) ;
127
127
const modulePath = operator . getModulePath ( moduleData ) ;
128
128
const varData = operator . getVarData ( modulePath , context ) ;
129
- const vars = operator . transformToStyleVars ( varData ) ;
129
+ const vars = operator . transformToStyleVars ( { type : 'less' , varData } ) ;
130
130
131
- expect ( operator . mergeVarsToContent ( content , context ) ) . toEqual ( vars + stylesContent ) ;
131
+ expect ( operator . mergeVarsToContent ( content , context , 'less' ) ) . toEqual ( vars + stylesContent ) ;
132
132
} ) ;
133
133
134
134
it ( 'gives back content as is if there is no requre' , ( ) => {
@@ -176,5 +176,13 @@ describe('js-to-styles-vars-loader', () => {
176
176
operator . transformToStyleVars ( { type : 'less' , varData : { } } ) ;
177
177
expect ( operator . transformToLessVars ) . toHaveBeenCalled ( ) ;
178
178
} ) ;
179
+
180
+ it ( 'throws error is type is unknown' , ( ) => {
181
+ const caller = ( ) => {
182
+ operator . transformToStyleVars ( { type : 'unknown' } ) ;
183
+ } ;
184
+
185
+ expect ( caller ) . toThrow ( ) ;
186
+ } ) ;
179
187
} ) ;
180
188
} ) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ const operator = {
63
63
return this . transformToSassVars ( varData ) ;
64
64
case 'less' :
65
65
return this . transformToLessVars ( varData ) ;
66
+ default :
67
+ throw Error ( `Unknown preprocessor type: ${ type } ` ) ;
66
68
67
69
}
68
70
} ,
You can’t perform that action at this time.
0 commit comments