File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export * from './values.mjs'
Original file line number Diff line number Diff line change @@ -139,6 +139,23 @@ describe('@knighted/module', () => {
139139 assert . ok ( / t y p e : m o d u l e / . test ( conditional ! . message ) )
140140 } )
141141
142+ it ( 'lowers export star reexports to cjs' , async t => {
143+ const fixturePath = join ( fixtures , 'exportAll.mjs' )
144+ const outFile = join ( fixtures , 'exportAll.cjs' )
145+
146+ t . after ( ( ) => rm ( outFile , { force : true } ) )
147+
148+ const result = await transform ( fixturePath , { target : 'commonjs' } )
149+ await writeFile ( outFile , result )
150+
151+ const requireFromHere = createRequire ( import . meta. url )
152+ const mod = requireFromHere ( outFile )
153+
154+ assert . equal ( mod . foo , 'bar' )
155+ assert . equal ( mod . esmodule , true )
156+ assert . equal ( Object . prototype . hasOwnProperty . call ( mod , 'default' ) , false )
157+ } )
158+
142159 it ( 'transforms __filename' , async t => {
143160 const result = await transform ( join ( fixtures , '__filename.cjs' ) , {
144161 target : 'module' ,
You can’t perform that action at this time.
0 commit comments