diff --git a/README.md b/README.md index 7593abe..d8ae513 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,11 @@ You'll need to set a value for PUBLIC_TRUSTED_HOST in the .env file, e.g.: PUBLIC_TRUSTED_HOST="http://localhost:8080" There is a `sample.env` for your reference. you can: `cp sample.env .env` and then edit that .env file. + +## Test harness + +A local test page is in `test/index.html`. It embeds the runner in an iframe and lets you send programs via `postMessage`. With `PUBLIC_TRUSTED_HOST="http://localhost:8080"` in your `.env` and `npm run dev` running, open a second terminal and run: + + npm run test-ui + +Then visit `http://localhost:8080` and click **▶ Run**. diff --git a/package.json b/package.json index f56d4b6..521adaf 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --plugin-search-dir . --check . && eslint .", + "test-ui": "npx serve test -p 8080", "zip": "zip -r ./static/vpython.zip vpython", "format": "prettier --plugin-search-dir . --write ." }, diff --git a/src/lib/utils/utils.js b/src/lib/utils/utils.js index d4bd691..7156e03 100644 --- a/src/lib/utils/utils.js +++ b/src/lib/utils/utils.js @@ -4,7 +4,7 @@ await micropip.install('/cyvector-0.1-cp311-cp311-emscripten_3_1_39_wasm32.whl') export const getPyodide = async (stdOutRedir, stdErrRedir, url) => { const t0 = performance.now() - console.log(`=== utils.js v2.0.2 - Pyodide v0.23.3 ===`) + console.log(`=== utils.js v2.0.2 - Pyodide v0.29.4 ===`) console.log(`[${t0.toFixed(2)}ms] Starting getPyodide`) const pkgResponse = fetch('vpython.zip').then((x) => x.arrayBuffer()) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 64a9896..d38fddd 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,5 @@ - + { - console.log('=== wmWVPRunner v2.0.2 - Using Pyodide v0.23.3 (last known working) ===') - console.log('Newer Pyodide versions cause Chrome stack overflow with vpython.vector') + console.log('=== wmWVPRunner v2.0.2 - Using Pyodide v0.29.4 ===') console.log('Public host =', PUBLIC_TRUSTED_HOST) mounted = true window.addEventListener('message', (e) => { diff --git a/test/index.html b/test/index.html new file mode 100644 index 0000000..401aafd --- /dev/null +++ b/test/index.html @@ -0,0 +1,335 @@ + + + + + wmWVPRunner Test + + + +
+ + + + + + idle +
+ +
+
+ +
+
stdout / stderr
+ +
+
+
+ +
+
+ + + +