Skip to content

Commit

Permalink
Fix test failures (#300)
Browse files Browse the repository at this point in the history
* Fix upload artifact

* Fix STDIN with large inputs
  • Loading branch information
taybenlor authored Nov 17, 2024
1 parent 2abdc7c commit b252dba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: npm run test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
10 changes: 5 additions & 5 deletions packages/wasi/tests/libstd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ for (const name of wasmFiles) {

let stderr = "";
let stdout = "";
let stdinBytes = new TextEncoder().encode(stdin ?? "");

return W.start(
fetch(url),
Expand All @@ -69,11 +70,10 @@ for (const name of wasmFiles) {
stderr: (s) => {
stderr += s;
},
stdin: (maxByteLength: number) => {
const index = Math.floor(maxByteLength / 2) + 1;
const retvalue = stdin.slice(0, index);
stdin = stdin.slice(index);
return retvalue;
stdin: (maxByteLength) => {
const chunk = stdinBytes.slice(0, maxByteLength);
stdinBytes = stdinBytes.slice(maxByteLength);
return new TextDecoder().decode(chunk);
},
fs,
})
Expand Down

0 comments on commit b252dba

Please sign in to comment.