File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,17 @@ describe("Raw plugin", () => {
3636 expect ( generatedCodeContent2 . toString ( "base64" ) ) . toBe ( fileContent . toString ( "base64" ) ) ;
3737 } ) ;
3838
39+ test ( "test buffer" , async ( { expect } ) => {
40+ await esbuild . build ( { ...buildOptions , entryPoints : [ path . resolve ( __dirname , "test4.ts" ) ] } ) ;
41+ const fileContent = fs . readFileSync ( path . resolve ( __dirname , "../src/index.ts" ) ) ;
42+ // @ts -ignore
43+ const generatedCodeContent = ( await import ( "./dist/test4.js" ) ) . getBuffer ( ) ;
44+ // @ts -ignore
45+ expect ( Buffer . from ( generatedCodeContent ) . toString ( "base64" ) ) . toBe (
46+ fileContent . toString ( "base64" ) ,
47+ ) ;
48+ } ) ;
49+
3950 test ( "throws error if no file is found" , async ( { expect } ) => {
4051 let didThrow = false ;
4152 try {
Original file line number Diff line number Diff line change 1+ // test auto complete
2+
3+ import buffer from "../src?binary" ;
4+
5+ export const getBuffer = ( ) => buffer ;
You can’t perform that action at this time.
0 commit comments