@@ -116,6 +116,45 @@ describe("autoload config", () => {
116116 ) ;
117117 } ) ;
118118
119+ it ( 'should load ESM version of "postcss.config.js" with "Array" syntax of plugins' , async ( ) => {
120+ const loadedConfig = await loadConfig (
121+ loaderContext ,
122+ path . resolve ( testDirectory , "js/array-esm-js" ) ,
123+ ) ;
124+
125+ expect ( loadedConfig . config . map ) . toEqual ( false ) ;
126+ expect ( loadedConfig . config . from ) . toEqual (
127+ "./test/fixtures/config-autoload/js/object/index.css" ,
128+ ) ;
129+ expect ( loadedConfig . config . to ) . toEqual (
130+ "./test/fixtures/config-autoload/js/object/expect/index.css" ,
131+ ) ;
132+ expect ( Object . keys ( loadedConfig . config . plugins ) . length ) . toEqual ( 4 ) ;
133+ expect ( loadedConfig . filepath ) . toEqual (
134+ path . resolve ( testDirectory , "js/array-esm-js" , "postcss.config.js" ) ,
135+ ) ;
136+ } ) ;
137+
138+ // TODO Test manually with NODE_OPTIONS=--experimental-vm-modules to enable ESM support in jest
139+ it . skip ( 'should load "postcss.config.mjs" with "Array" syntax of plugins' , async ( ) => {
140+ const loadedConfig = await loadConfig (
141+ loaderContext ,
142+ path . resolve ( testDirectory , "js/array-mjs" ) ,
143+ ) ;
144+
145+ expect ( loadedConfig . config . map ) . toEqual ( false ) ;
146+ expect ( loadedConfig . config . from ) . toEqual (
147+ "./test/fixtures/config-autoload/js/object/index.css" ,
148+ ) ;
149+ expect ( loadedConfig . config . to ) . toEqual (
150+ "./test/fixtures/config-autoload/js/object/expect/index.css" ,
151+ ) ;
152+ expect ( Object . keys ( loadedConfig . config . plugins ) . length ) . toEqual ( 4 ) ;
153+ expect ( loadedConfig . filepath ) . toEqual (
154+ path . resolve ( testDirectory , "js/array-mjs" , "postcss.config.mjs" ) ,
155+ ) ;
156+ } ) ;
157+
119158 it ( 'should load "postcss.config.ts" with "Array" syntax of plugins' , async ( ) => {
120159 const loadedConfig = await loadConfig (
121160 loaderContext ,
0 commit comments