@@ -109,9 +109,9 @@ suite('Builtins', () => {
109109 reject (
110110 new Error (
111111 'test timed out with output:\n' +
112- stdout +
113- '\n\nstderr:\n' +
114- stderr
112+ stdout +
113+ '\n\nstderr:\n' +
114+ stderr
115115 )
116116 ) ;
117117 } , 10_000 ) ;
@@ -254,7 +254,7 @@ suite('Bindings', () => {
254254} ) ;
255255
256256suite ( 'WASI' , ( ) => {
257- test ( 'basic app' , async ( ) => {
257+ test ( 'basic app (old API) ' , async ( ) => {
258258 const { component } = await componentize (
259259 `
260260 import { now } from 'wasi:clocks/wall-clock@0.2.3';
@@ -301,4 +301,40 @@ suite('WASI', () => {
301301 strictEqual ( result . slice ( 0 , 10 ) , `NOW: ${ String ( Date . now ( ) ) . slice ( 0 , 5 ) } ` ) ;
302302 strictEqual ( result . split ( ',' ) . length , 3 ) ;
303303 } ) ;
304+
305+ test ( 'basic app (OriginalSourceFile API)' , async ( ) => {
306+ const { component } = await componentize (
307+ {
308+ sourcePath : "./test/api/index.js" ,
309+ witPath : fileURLToPath ( new URL ( './wit' , import . meta. url ) ) ,
310+ worldName : 'test1' ,
311+ enableAot,
312+ debugBuild,
313+ }
314+ ) ;
315+
316+ await writeFile (
317+ new URL ( `./output/wasi.component.wasm` , import . meta. url ) ,
318+ component
319+ ) ;
320+
321+ const { files } = await transpile ( component , { tracing : DEBUG_TRACING } ) ;
322+
323+ await mkdir ( new URL ( `./output/wasi/interfaces` , import . meta. url ) , {
324+ recursive : true ,
325+ } ) ;
326+
327+ for ( const file of Object . keys ( files ) ) {
328+ await writeFile (
329+ new URL ( `./output/wasi/${ file } ` , import . meta. url ) ,
330+ files [ file ]
331+ ) ;
332+ }
333+
334+ var instance = await import ( `./output/wasi/component.js` ) ;
335+ instance . run . run ( ) ;
336+ const result = instance . getResult ( ) ;
337+ strictEqual ( result . slice ( 0 , 10 ) , `NOW: ${ String ( Date . now ( ) ) . slice ( 0 , 5 ) } ` ) ;
338+ strictEqual ( result . split ( ',' ) . length , 3 ) ;
339+ } ) ;
304340} ) ;
0 commit comments