Skip to content

Commit 2f17ab1

Browse files
test(jco): update/fix tests with updated component bindgen
1 parent 60bb773 commit 2f17ab1

File tree

9 files changed

+32
-9
lines changed

9 files changed

+32
-9
lines changed

crates/js-component-bindgen/src/function_bindgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ impl Bindgen for FunctionBindgen<'_> {
22372237
reject
22382238
}});
22392239
}} catch (err) {{
2240-
console.log("[AsyncTaskReturn] DRIVER LOOP CALL FAILED?", {{ err }});
2240+
{debug_log_fn}("[AsyncTaskReturn] driver loop call failure", {{ err }});
22412241
}}
22422242
}});
22432243

crates/js-component-bindgen/src/intrinsics/p3/host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl HostIntrinsic {
329329
reject
330330
}});
331331
}} catch (err) {{
332-
console.log("[AsyncStartCall] DRIVER LOOP CALL FAILED?", {{ err }});
332+
{debug_log_fn}("[AsyncStartCall] drive loop call failure", {{ err }});
333333
}}
334334
335335
}});

examples/guides/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ often referencing or building up to [example WebAssembly components](./../compon
99
| [00 - Tooling setup][00] | Get started with JS WebAssembly tooling |
1010
| [01 - Building a Component with `jco`][01] | Build a simple component ([`add.wasm`][comp-add]) |
1111
| [02 - Running components in Javascript][02] | How to run components from existing JS code |
12-
| [03 - Exporting fucntionality with rich types][03] | Exporting functionality from ([`string-reverse.wasm`][comp-sreverse]) |
12+
| [03 - Exporting functionality with rich types][03] | Exporting functionality from ([`string-reverse.wasm`][comp-sreverse]) |
1313
| [04 - Importing and reusing components][04] | Importing and Exporting advanced functionality ([`string-reverse-upper.wasm`][comp-sreverse-upper]) |
1414
| | |
1515

packages/jco/test/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ export async function startTestWebServer(args) {
500500
const serverPort = await getRandomPort();
501501

502502
const server = createHttpServer(async (req, res) => {
503-
// Build a utility fucntion for returning an error
503+
// Build a utility function for returning an error
504504
const returnError = (e) => {
505505
log(`[webserver] failed to find file [${fileURL}]`);
506506
res.writeHead(404);

packages/jco/test/p3/context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ suite('Context (WASI P3)', () => {
4343
});
4444

4545
// TODO: re-enable after support of async task results
46-
test.skip('context.get/set (async export, async porcelain)', async () => {
46+
test('context.get/set (async export, async porcelain)', async () => {
4747
const componentName = 'context-async';
4848
const componentPath = join(
4949
P3_COMPONENT_FIXTURES_DIR,
@@ -81,7 +81,7 @@ suite('Context (WASI P3)', () => {
8181

8282
// TODO: re-enable after support of async task results
8383
// TODO: support *Sync() variants of task fns like yield()
84-
test.skip('context.get/set (async export, sync porcelain)', async () => {
84+
test('context.get/set (async export, sync porcelain)', async () => {
8585
const componentName = 'context-async';
8686
const componentPath = join(
8787
P3_COMPONENT_FIXTURES_DIR,

packages/jco/test/p3/ported/wasmtime/component-async/backpressure.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ suite('backpressure scenario', () => {
2626

2727
let cleanup;
2828
try {
29-
const res = await buildAndTranspile({ componentPath });
29+
const res = await buildAndTranspile({
30+
componentPath,
31+
transpile: {
32+
extraArgs: {
33+
minify: false,
34+
}
35+
}
36+
});
3037
const instance = res.instance;
3138
cleanup = res.cleanup;
3239
await instance['local:local/run'].asyncRun();

packages/jco/test/p3/ported/wasmtime/component-async/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export async function buildAndTranspile(args) {
4646
jco: {
4747
transpile: {
4848
extraArgs: {
49+
asyncExports: ['local:local/run#run'] ,
4950
...(args.transpile?.extraArgs || {}),
50-
asyncExports: ['local:local/run#run'],
5151
},
5252
},
5353
},

packages/jco/test/p3/ported/wasmtime/component-async/error-context.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ suite('error-context scenario', () => {
4343

4444
let cleanup;
4545
try {
46-
const res = await buildAndTranspile({ componentPath });
46+
const res = await buildAndTranspile({
47+
componentPath,
48+
transpile: {
49+
extraArgs: {
50+
minify: false,
51+
}
52+
},
53+
});
4754
cleanup = res.cleanup;
4855
const instance = res.instance;
4956
await instance['local:local/run'].asyncRun();

packages/jco/test/p3/ported/wasmtime/component-async/post-return.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ suite('post-return async sleep scenario', () => {
8787
transpile: {
8888
extraArgs: {
8989
minify: false,
90+
asyncImports: [
91+
// Provided by the host
92+
'local:local/sleep#sleep-millis',
93+
],
94+
asyncExports: [
95+
// NOTE: Provided by the component, but *does* trigger calling
96+
// of the host-provided async improt
97+
'local:local/sleep-post-return#run',
98+
],
9099
}
91100
},
92101
});

0 commit comments

Comments
 (0)