11const path = require ( 'path' ) ;
22const sassExtract = require ( 'sass-extract' ) ;
3- const js = require ( '../index ' ) ;
3+ const createPlugin = require ( '../lib/plugin ' ) ;
44
55const testfiles = {
66 basic : path . resolve ( __dirname , './sass/test-basic.scss' ) ,
@@ -10,8 +10,11 @@ const testfiles = {
1010 empty : path . resolve ( __dirname , './sass/test-empty.scss' ) ,
1111} ;
1212
13- const getVars = ( file , compileOpts = { } ) =>
14- sassExtract . renderSync ( Object . assign ( { } , { file } , compileOpts ) , { plugins : [ js ] } ) . vars ;
13+ const getVars = ( file , compileOpts = { } , pluginInstance ) =>
14+ sassExtract . renderSync (
15+ Object . assign ( { } , { file } , compileOpts ) ,
16+ { plugins : [ pluginInstance || path . resolve ( '../sass-extract-js' ) ] } ,
17+ ) . vars ;
1518
1619describe ( 'sass-extract-js' , ( ) => {
1720 it ( 'should convert basic SASS vars' , ( ) => {
@@ -36,4 +39,10 @@ describe('sass-extract-js', () => {
3639 } ;
3740 expect ( getVars ( testfiles . sassOpts , opts ) ) . toMatchSnapshot ( ) ;
3841 } ) ;
42+
43+ describe ( 'options' , ( ) => {
44+ it ( 'should NOT convert keys to camelCase when options.camelCase is false' , ( ) => {
45+ expect ( getVars ( testfiles . camel , { } , createPlugin ( { camelCase : false } ) ) ) . toMatchSnapshot ( ) ;
46+ } ) ;
47+ } ) ;
3948} ) ;
0 commit comments