-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy up event loop handling code (#697)
* Tidy up event loop handling code This commit refactors the event loop handling code, mainly by extracting the common pieces into a reusable function. Additionally, this commit ensures that the result of `Promise.finish` is corectly handled, which fixes execution of code with top level awaits. Finally, this commit also ensures that we test the `experimental_event_loop` in CI for the CLI and core crates (follow-up to #238) * Clippy fixes * Assert fuel conditionally When the `experimental_event_loop` feature is enabled, a bit more work is done when executing JS code, therefore there's more fuel usage reported in some tests. * Create `cli-features.yml` * Add right naming * Fix `runs-on` key * Typo and fixes
- Loading branch information
1 parent
0bfd2bf
commit f8dea1b
Showing
4 changed files
with
77 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Tests extra CLI features and their dependency with core features. | ||
name: Test CLI Features | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
cli: | ||
name: Test CLI Features | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ./.github/actions/ci-shared-setup | ||
with: | ||
os: linux | ||
|
||
- name: Test `experimental_event_loop` | ||
run: | | ||
cargo build --package=javy-core --target=wasm32-wasi --release --features=experimental_event_loop | ||
cargo test --package=javy-cli --features=experimental_event_loop --release -- --nocapture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
async function foo() { | ||
return Promise.resolve("bar"); | ||
} | ||
|
||
const output = new TextEncoder().encode(await foo()); | ||
Javy.IO.writeSync(1, output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters