@@ -47,10 +47,7 @@ describe("esbuild proxy module default export handling", () => {
4747 // undefined" will be captured in result.warnings. On older esbuild versions this array
4848 // may be empty regardless, so the test at least verifies no build errors occur.
4949 const importUndefinedWarnings = ( result . warnings || [ ] ) . filter (
50- ( w ) =>
51- w . text . includes ( "Import" ) &&
52- w . text . includes ( "default" ) &&
53- w . text . includes ( "undefined" )
50+ ( w ) => w . text . includes ( "Import" ) && w . text . includes ( "default" ) && w . text . includes ( "undefined" )
5451 ) ;
5552
5653 expect ( importUndefinedWarnings ) . toHaveLength ( 0 ) ;
@@ -60,11 +57,9 @@ describe("esbuild proxy module default export handling", () => {
6057 const inputFile = path . join ( tmpDir , "with-default.ts" ) ;
6158 fs . writeFileSync (
6259 inputFile ,
63- [
64- "export const foo = 42;" ,
65- 'export default function main() { return "hello"; }' ,
66- "" ,
67- ] . join ( "\n" )
60+ [ "export const foo = 42;" , 'export default function main() { return "hello"; }' , "" ] . join (
61+ "\n"
62+ )
6863 ) ;
6964
7065 const outDir = path . join ( tmpDir , "out-with-default" ) ;
@@ -86,29 +81,23 @@ describe("esbuild proxy module default export handling", () => {
8681
8782 // Should produce no warnings
8883 const importUndefinedWarnings = ( result . warnings || [ ] ) . filter (
89- ( w ) =>
90- w . text . includes ( "Import" ) &&
91- w . text . includes ( "default" ) &&
92- w . text . includes ( "undefined" )
84+ ( w ) => w . text . includes ( "Import" ) && w . text . includes ( "default" ) && w . text . includes ( "undefined" )
9385 ) ;
9486 expect ( importUndefinedWarnings ) . toHaveLength ( 0 ) ;
9587
9688 // Verify the output contains the default export function
9789 const outputFiles = fs . readdirSync ( outDir ) . filter ( ( f ) => f . endsWith ( ".js" ) ) ;
9890 expect ( outputFiles . length ) . toBeGreaterThan ( 0 ) ;
9991
100- const outputContent = fs . readFileSync (
101- path . join ( outDir , outputFiles [ 0 ] as string ) ,
102- "utf-8"
103- ) ;
92+ const outputContent = fs . readFileSync ( path . join ( outDir , outputFiles [ 0 ] as string ) , "utf-8" ) ;
10493 expect ( outputContent ) . toContain ( "main" ) ;
10594 } ) ;
10695
10796 it ( "should preserve named exports when the entry point has no default export" , async ( ) => {
10897 const inputFile = path . join ( tmpDir , "named-only.ts" ) ;
10998 fs . writeFileSync (
11099 inputFile ,
111- [ ' export const foo = 42;' , 'export const bar = "hello";' , "" ] . join ( "\n" )
100+ [ " export const foo = 42;" , 'export const bar = "hello";' , "" ] . join ( "\n" )
112101 ) ;
113102
114103 const outDir = path . join ( tmpDir , "out-named-only" ) ;
@@ -130,21 +119,15 @@ describe("esbuild proxy module default export handling", () => {
130119
131120 // Should produce no warnings
132121 const importUndefinedWarnings = ( result . warnings || [ ] ) . filter (
133- ( w ) =>
134- w . text . includes ( "Import" ) &&
135- w . text . includes ( "default" ) &&
136- w . text . includes ( "undefined" )
122+ ( w ) => w . text . includes ( "Import" ) && w . text . includes ( "default" ) && w . text . includes ( "undefined" )
137123 ) ;
138124 expect ( importUndefinedWarnings ) . toHaveLength ( 0 ) ;
139125
140126 // Verify the output contains the named exports
141127 const outputFiles = fs . readdirSync ( outDir ) . filter ( ( f ) => f . endsWith ( ".js" ) ) ;
142128 expect ( outputFiles . length ) . toBeGreaterThan ( 0 ) ;
143129
144- const outputContent = fs . readFileSync (
145- path . join ( outDir , outputFiles [ 0 ] as string ) ,
146- "utf-8"
147- ) ;
130+ const outputContent = fs . readFileSync ( path . join ( outDir , outputFiles [ 0 ] as string ) , "utf-8" ) ;
148131 expect ( outputContent ) . toContain ( "foo" ) ;
149132 expect ( outputContent ) . toContain ( "bar" ) ;
150133 } ) ;
0 commit comments