diff --git a/.github/workflows/test-on-pull-request.yml b/.github/workflows/test-on-pull-request.yml index 5850c5f4..58175a33 100644 --- a/.github/workflows/test-on-pull-request.yml +++ b/.github/workflows/test-on-pull-request.yml @@ -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 diff --git a/packages/wasi/tests/libstd.spec.ts b/packages/wasi/tests/libstd.spec.ts index 93d734b2..a5151818 100644 --- a/packages/wasi/tests/libstd.spec.ts +++ b/packages/wasi/tests/libstd.spec.ts @@ -57,6 +57,7 @@ for (const name of wasmFiles) { let stderr = ""; let stdout = ""; + let stdinBytes = new TextEncoder().encode(stdin ?? ""); return W.start( fetch(url), @@ -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, })