@@ -209,6 +209,12 @@ function pluginTester({
209209const createFixtureTests = ( fixturesDir , options ) => {
210210 if ( ! fs . statSync ( fixturesDir ) . isDirectory ( ) ) return
211211
212+ const rootOptionsPath = path . join ( fixturesDir , 'options.json' )
213+ let rootFixtureOptions = { }
214+ if ( pathExists . sync ( rootOptionsPath ) ) {
215+ rootFixtureOptions = require ( rootOptionsPath )
216+ }
217+
212218 fs . readdirSync ( fixturesDir ) . forEach ( caseName => {
213219 const fixtureDir = path . join ( fixturesDir , caseName )
214220 const optionsPath = path . join ( fixtureDir , 'options.json' )
@@ -228,7 +234,11 @@ const createFixtureTests = (fixturesDir, options) => {
228234 describe ( blockTitle , ( ) => {
229235 createFixtureTests ( fixtureDir , {
230236 ...options ,
231- pluginOptions : { ...options . pluginOptions , ...fixturePluginOptions } ,
237+ pluginOptions : {
238+ ...rootFixtureOptions ,
239+ ...options . pluginOptions ,
240+ ...fixturePluginOptions ,
241+ } ,
232242 } )
233243 } )
234244 return
@@ -252,7 +262,16 @@ const createFixtureTests = (fixturesDir, options) => {
252262 fullDefaultConfig ,
253263 {
254264 babelOptions : {
255- plugins : [ [ plugin , { ...pluginOptions , ...fixturePluginOptions } ] ] ,
265+ plugins : [
266+ [
267+ plugin ,
268+ {
269+ ...rootFixtureOptions ,
270+ ...pluginOptions ,
271+ ...fixturePluginOptions ,
272+ } ,
273+ ] ,
274+ ] ,
256275 // if they have a babelrc, then we'll let them use that
257276 // otherwise, we'll just use our simple config
258277 babelrc : pathExists . sync ( babelRcPath ) ,
0 commit comments