diff --git a/src/filter.ts b/src/filter.ts index 3055f170..c7a8cfb8 100644 --- a/src/filter.ts +++ b/src/filter.ts @@ -17,8 +17,12 @@ export const filter = { 'rust-game-of-life', // fail only at CI ], proxy: [ - // Regressions: revisit after unit - "external-call", + // TODO: fix these regressions + "basic-new-Instance-module", // TypeError: Cannot read properties of undefined (reading 'forEach') + "basic-new-Instance-compile", // TypeError: Cannot read properties of undefined (reading 'forEach') + "basic-new-Instance-compileStreaming", // TypeError: Cannot read properties of undefined (reading 'forEach') + "external-call", // SyntaxError: Identifier 'wasm' has already been declared + "multiple-worker-different-name", // SyntaxError: Identifier 'MEM_PAGE_SIZE' has already been declared ], online: [ "heatmap", // works fine, but too long so we skip it diff --git a/tests/proxy/basic-instantiate/website/index.html b/tests/proxy/basic-instantiate/website/index.html index 12f62800..65425b4b 100644 --- a/tests/proxy/basic-instantiate/website/index.html +++ b/tests/proxy/basic-instantiate/website/index.html @@ -10,7 +10,15 @@ fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => WebAssembly.instantiate(bytes, {})) - .then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); + .then((result) => { + const startTime = performance.now(); + console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`) + const endTime = performance.now(); + const executionTime = endTime - startTime; + const executionTimeElement = document.createElement('p'); + executionTimeElement.textContent = `Execution time: ${executionTime} milliseconds`; + document.body.appendChild(executionTimeElement); + }); diff --git a/tests/proxy/basic-instantiateStreaming/test.js b/tests/proxy/basic-instantiateStreaming/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/basic-instantiateStreaming/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/basic-instantiateStreaming/website/index.html b/tests/proxy/basic-instantiateStreaming/website/index.html index 69eac42c..6171f7ae 100644 --- a/tests/proxy/basic-instantiateStreaming/website/index.html +++ b/tests/proxy/basic-instantiateStreaming/website/index.html @@ -8,7 +8,15 @@ diff --git a/tests/proxy/basic-new-Instance-compile/test.js b/tests/proxy/basic-new-Instance-compile/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/basic-new-Instance-compile/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/basic-new-Instance-compile/website/index.html b/tests/proxy/basic-new-Instance-compile/website/index.html index d7634b41..12ae1874 100644 --- a/tests/proxy/basic-new-Instance-compile/website/index.html +++ b/tests/proxy/basic-new-Instance-compile/website/index.html @@ -11,8 +11,14 @@ .then((response) => response.arrayBuffer()) .then((bytes) => WebAssembly.compile(bytes)) .then((module) => { + const startTime = performance.now(); const instance = new WebAssembly.Instance(module, {}) console.log(`1 + 2 = ${instance.exports.add(1, 2)}`) + const endTime = performance.now(); + const executionTime = endTime - startTime; + const executionTimeElement = document.createElement('p'); + executionTimeElement.textContent = `Execution time: ${executionTime} milliseconds`; + document.body.appendChild(executionTimeElement); }) diff --git a/tests/proxy/basic-new-Instance-compileStreaming/reference.r3 b/tests/proxy/basic-new-Instance-compileStreaming/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/basic-new-Instance-compileStreaming/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/basic-new-Instance-compileStreaming/test.js b/tests/proxy/basic-new-Instance-compileStreaming/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/basic-new-Instance-compileStreaming/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/basic-new-Instance-compileStreaming/website/index.html b/tests/proxy/basic-new-Instance-compileStreaming/website/index.html index 0b6f8be6..2ea9e80f 100644 --- a/tests/proxy/basic-new-Instance-compileStreaming/website/index.html +++ b/tests/proxy/basic-new-Instance-compileStreaming/website/index.html @@ -9,8 +9,14 @@ diff --git a/tests/proxy/basic-new-Instance-module/reference.r3 b/tests/proxy/basic-new-Instance-module/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/basic-new-Instance-module/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/basic-new-Instance-module/test.js b/tests/proxy/basic-new-Instance-module/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/basic-new-Instance-module/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/external-call/test.js b/tests/proxy/external-call/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/external-call/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/frame-in-frame/reference.r3 b/tests/proxy/frame-in-frame/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/frame-in-frame/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/frame-in-frame/test.js b/tests/proxy/frame-in-frame/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/frame-in-frame/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/frame-in-frame/website/index.html b/tests/proxy/frame-in-frame/website/index.html index 1ef0ff62..d694b1ba 100644 --- a/tests/proxy/frame-in-frame/website/index.html +++ b/tests/proxy/frame-in-frame/website/index.html @@ -7,6 +7,24 @@ + \ No newline at end of file diff --git a/tests/proxy/frames/reference.r3 b/tests/proxy/frames/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/frames/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/frames/test.js b/tests/proxy/frames/test.js deleted file mode 100644 index eb47da84..00000000 --- a/tests/proxy/frames/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(100) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/frames/website/index.html b/tests/proxy/frames/website/index.html index ee5bd8ab..a5f25ed9 100644 --- a/tests/proxy/frames/website/index.html +++ b/tests/proxy/frames/website/index.html @@ -8,6 +8,24 @@ + \ No newline at end of file diff --git a/tests/proxy/multiple-wasm-files/reference.r3 b/tests/proxy/multiple-wasm-files/reference.r3 new file mode 100644 index 00000000..b686c4b3 --- /dev/null +++ b/tests/proxy/multiple-wasm-files/reference.r3 @@ -0,0 +1,2 @@ +EC;0;mul;3,3 +ER \ No newline at end of file diff --git a/tests/proxy/multiple-wasm-files/test.js b/tests/proxy/multiple-wasm-files/test.js deleted file mode 100644 index 624bfb93..00000000 --- a/tests/proxy/multiple-wasm-files/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(3000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/multiple-wasm-files/website/index.html b/tests/proxy/multiple-wasm-files/website/index.html index 35341175..bc70091e 100644 --- a/tests/proxy/multiple-wasm-files/website/index.html +++ b/tests/proxy/multiple-wasm-files/website/index.html @@ -7,20 +7,55 @@ - + (async function() { + const startTime = performance.now(); + + // Function to load and instantiate a WASM module + async function loadWasm(url) { + const response = await fetch(url); + const bytes = await response.arrayBuffer(); + return WebAssembly.instantiate(bytes, {}); + } + + try { + // Load and execute add.wasm (first instance) + const add1 = await loadWasm("add.wasm"); + console.log(`10 + 2 = ${add1.instance.exports.add(10, 2)}`); + + // Load and execute add.wasm (second instance) + const add2 = await loadWasm("add.wasm"); + console.log(`1 + 1 = ${add2.instance.exports.add(1, 1)}`); + + // Load and execute sub.wasm + const sub = await loadWasm("sub.wasm"); + console.log(`9 - 3 = ${sub.instance.exports.sub(9, 3)}`); + + // Create a new Worker + const worker = new Worker('worker.js'); + // Wait for the worker to initialize (if needed) + await new Promise(resolve => { + worker.onmessage = (e) => { + if (e.data === 'finished') { + resolve(); + } + }; + }); + + const endTime = performance.now(); + const executionTime = endTime - startTime; + + console.log(`Total execution time: ${executionTime} milliseconds`); + + // Create and append execution time element to the body + const executionTimeElement = document.createElement('p'); + executionTimeElement.textContent = `Total execution time: ${executionTime.toFixed(2)} milliseconds`; + document.body.appendChild(executionTimeElement); + + } catch (error) { + console.error("An error occurred:", error); + } + })(); + + \ No newline at end of file diff --git a/tests/proxy/multiple-wasm-files/website/worker.js b/tests/proxy/multiple-wasm-files/website/worker.js index 4bb0d507..b95942a8 100644 --- a/tests/proxy/multiple-wasm-files/website/worker.js +++ b/tests/proxy/multiple-wasm-files/website/worker.js @@ -1,8 +1,21 @@ -fetch("mul.wasm") - .then((response) => response.arrayBuffer()) - .then((bytes) => WebAssembly.instantiate(bytes, {})) - .then((result) => console.log(`3 x 3 = ${result.instance.exports.mul(3, 3)}`)); -fetch("div.wasm") - .then((response) => response.arrayBuffer()) - .then((bytes) => WebAssembly.instantiate(bytes, {})) - .then((result) => console.log(`3 / 3 = ${result.instance.exports.div(3, 3)}`)); \ No newline at end of file +Promise.all([ + fetch("mul.wasm") + .then((response) => response.arrayBuffer()) + .then((bytes) => WebAssembly.instantiate(bytes, {})) + .then((result) => { + console.log(`3 x 3 = ${result.instance.exports.mul(3, 3)}`); + return result; + }), + fetch("div.wasm") + .then((response) => response.arrayBuffer()) + .then((bytes) => WebAssembly.instantiate(bytes, {})) + .then((result) => { + console.log(`3 / 3 = ${result.instance.exports.div(3, 3)}`); + return result; + }) +]).then(() => { + self.postMessage('finished'); +}).catch((error) => { + console.error("An error occurred:", error); + self.postMessage('error'); +}); \ No newline at end of file diff --git a/tests/proxy/multiple-worker-different-name/reference.r3 b/tests/proxy/multiple-worker-different-name/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/multiple-worker-different-name/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/multiple-worker-different-name/test.js b/tests/proxy/multiple-worker-different-name/test.js deleted file mode 100644 index a281a69b..00000000 --- a/tests/proxy/multiple-worker-different-name/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/multiple-worker/reference.r3 b/tests/proxy/multiple-worker/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/multiple-worker/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/multiple-worker/test.js b/tests/proxy/multiple-worker/test.js deleted file mode 100644 index d52e6f0c..00000000 --- a/tests/proxy/multiple-worker/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(2000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/multiple-worker/website/index.html b/tests/proxy/multiple-worker/website/index.html index e5fbb8cc..8f6401a5 100644 --- a/tests/proxy/multiple-worker/website/index.html +++ b/tests/proxy/multiple-worker/website/index.html @@ -6,10 +6,36 @@ - - + + \ No newline at end of file diff --git a/tests/proxy/multiple-worker/website/second-worker.js b/tests/proxy/multiple-worker/website/second-worker.js index b16cb146..08927f54 100644 --- a/tests/proxy/multiple-worker/website/second-worker.js +++ b/tests/proxy/multiple-worker/website/second-worker.js @@ -1,7 +1,29 @@ +const startTime = performance.now(); + fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => { - console.log(bytes) - return WebAssembly.instantiate(bytes, {}) + console.log("Worker 2 bytes:", bytes); + return WebAssembly.instantiate(bytes, {}); }) - .then((result) => console.log(`3 + 4 = ${result.instance.exports.add(3, 4)}`)); \ No newline at end of file + .then((result) => { + const addResult = result.instance.exports.add(3, 4); + console.log(`Worker 2: 3 + 4 = ${addResult}`); + return addResult; + }) + .then((addResult) => { + const endTime = performance.now(); + const executionTime = endTime - startTime; + self.postMessage({ + status: 'completed', + result: `3 + 4 = ${addResult}`, + executionTime: executionTime + }); + }) + .catch((error) => { + console.error("An error occurred in worker 2:", error); + self.postMessage({ + status: 'error', + error: error.message + }); + }); \ No newline at end of file diff --git a/tests/proxy/multiple-worker/website/worker.js b/tests/proxy/multiple-worker/website/worker.js index 5bd93ca6..39589fec 100644 --- a/tests/proxy/multiple-worker/website/worker.js +++ b/tests/proxy/multiple-worker/website/worker.js @@ -1,7 +1,29 @@ +const startTime = performance.now(); + fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => { - console.log(bytes) - return WebAssembly.instantiate(bytes, {}) + console.log("Worker 1 bytes:", bytes); + return WebAssembly.instantiate(bytes, {}); }) - .then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); \ No newline at end of file + .then((result) => { + const addResult = result.instance.exports.add(1, 2); + console.log(`Worker 1: 1 + 2 = ${addResult}`); + return addResult; + }) + .then((addResult) => { + const endTime = performance.now(); + const executionTime = endTime - startTime; + self.postMessage({ + status: 'completed', + result: `1 + 2 = ${addResult}`, + executionTime: executionTime + }); + }) + .catch((error) => { + console.error("An error occurred in worker 1:", error); + self.postMessage({ + status: 'error', + error: error.message + }); + }); \ No newline at end of file diff --git a/tests/proxy/test.js b/tests/proxy/test.js index 8fa06f50..bb4579c9 100644 --- a/tests/proxy/test.js +++ b/tests/proxy/test.js @@ -1,7 +1,7 @@ -import { delay } from '../../dist/tests/test-utils.cjs' +import { expect } from "playwright/test"; export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) + const page = await analyser.start(url, { headless: true }) + await expect(page.getByText('milliseconds')).toBeVisible({ timeout: 1000 }); return await analyser.stop() } \ No newline at end of file diff --git a/tests/proxy/worker-and-normal/reference.r3 b/tests/proxy/worker-and-normal/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/worker-and-normal/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/worker-and-normal/test.js b/tests/proxy/worker-and-normal/test.js deleted file mode 100644 index a281a69b..00000000 --- a/tests/proxy/worker-and-normal/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/worker-and-normal/website/index.html b/tests/proxy/worker-and-normal/website/index.html index 1237d29a..3c968823 100644 --- a/tests/proxy/worker-and-normal/website/index.html +++ b/tests/proxy/worker-and-normal/website/index.html @@ -7,15 +7,41 @@ - \ No newline at end of file diff --git a/tests/proxy/worker-and-normal/website/worker.js b/tests/proxy/worker-and-normal/website/worker.js index 5bd93ca6..1b0908f2 100644 --- a/tests/proxy/worker-and-normal/website/worker.js +++ b/tests/proxy/worker-and-normal/website/worker.js @@ -1,7 +1,24 @@ fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => { - console.log(bytes) - return WebAssembly.instantiate(bytes, {}) + console.log("Worker bytes:", bytes); + return WebAssembly.instantiate(bytes, {}); }) - .then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); \ No newline at end of file + .then((result) => { + const addResult = result.instance.exports.add(1, 2); + console.log(`Worker: 1 + 2 = ${addResult}`); + return addResult; + }) + .then((addResult) => { + self.postMessage({ + status: 'initialized', + result: `1 + 2 = ${addResult}` + }); + }) + .catch((error) => { + console.error("An error occurred in worker:", error); + self.postMessage({ + status: 'error', + error: error.message + }); + }); \ No newline at end of file diff --git a/tests/proxy/worker-in-frame/reference.r3 b/tests/proxy/worker-in-frame/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/worker-in-frame/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/worker-in-frame/test.js b/tests/proxy/worker-in-frame/test.js deleted file mode 100644 index a281a69b..00000000 --- a/tests/proxy/worker-in-frame/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/worker-in-frame/website/frame1.html b/tests/proxy/worker-in-frame/website/frame1.html index 35d2f1f5..abfa7f68 100644 --- a/tests/proxy/worker-in-frame/website/frame1.html +++ b/tests/proxy/worker-in-frame/website/frame1.html @@ -1,14 +1,36 @@ - - + - Worker test + + + Frame 1 - - + - \ No newline at end of file diff --git a/tests/proxy/worker-in-frame/website/index.html b/tests/proxy/worker-in-frame/website/index.html index 1ef0ff62..83c513b5 100644 --- a/tests/proxy/worker-in-frame/website/index.html +++ b/tests/proxy/worker-in-frame/website/index.html @@ -1,12 +1,28 @@ - - + - Worker test + + + Worker test - - - + + + \ No newline at end of file diff --git a/tests/proxy/worker-two-instances/reference.r3 b/tests/proxy/worker-two-instances/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/worker-two-instances/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/worker-two-instances/test.js b/tests/proxy/worker-two-instances/test.js deleted file mode 100644 index a281a69b..00000000 --- a/tests/proxy/worker-two-instances/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/worker-two-instances/website/index.html b/tests/proxy/worker-two-instances/website/index.html index ae7c7eb4..2883405c 100644 --- a/tests/proxy/worker-two-instances/website/index.html +++ b/tests/proxy/worker-two-instances/website/index.html @@ -5,8 +5,34 @@ - + \ No newline at end of file diff --git a/tests/proxy/worker-two-instances/website/worker.js b/tests/proxy/worker-two-instances/website/worker.js index 5bd93ca6..d21380f3 100644 --- a/tests/proxy/worker-two-instances/website/worker.js +++ b/tests/proxy/worker-two-instances/website/worker.js @@ -1,7 +1,29 @@ +const startTime = performance.now(); + fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => { - console.log(bytes) - return WebAssembly.instantiate(bytes, {}) + console.log("Worker bytes:", bytes); + return WebAssembly.instantiate(bytes, {}); }) - .then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); \ No newline at end of file + .then((result) => { + const addResult = result.instance.exports.add(1, 2); + console.log(`1 + 2 = ${addResult}`); + return addResult; + }) + .then((addResult) => { + const endTime = performance.now(); + const executionTime = endTime - startTime; + self.postMessage({ + status: 'initialized', + result: `1 + 2 = ${addResult}`, + executionTime: executionTime + }); + }) + .catch((error) => { + console.error("An error occurred in worker:", error); + self.postMessage({ + status: 'error', + error: error.message + }); + }); \ No newline at end of file diff --git a/tests/proxy/worker/reference.r3 b/tests/proxy/worker/reference.r3 new file mode 100644 index 00000000..a338b2bc --- /dev/null +++ b/tests/proxy/worker/reference.r3 @@ -0,0 +1,2 @@ +EC;0;add;1,2 +ER \ No newline at end of file diff --git a/tests/proxy/worker/test.js b/tests/proxy/worker/test.js deleted file mode 100644 index a281a69b..00000000 --- a/tests/proxy/worker/test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { delay } from '../../../dist/tests/test-utils.cjs' - -export default async function test(analyser, url) { - await analyser.start(url, { headless: true }) - await delay(1000) - return await analyser.stop() -} \ No newline at end of file diff --git a/tests/proxy/worker/website/index.html b/tests/proxy/worker/website/index.html index 384e1353..3f12a1b9 100644 --- a/tests/proxy/worker/website/index.html +++ b/tests/proxy/worker/website/index.html @@ -2,10 +2,27 @@ Worker test - - + + - + \ No newline at end of file diff --git a/tests/proxy/worker/website/worker.js b/tests/proxy/worker/website/worker.js index 5bd93ca6..c77a8ccb 100644 --- a/tests/proxy/worker/website/worker.js +++ b/tests/proxy/worker/website/worker.js @@ -1,7 +1,24 @@ fetch("add.wasm") .then((response) => response.arrayBuffer()) .then((bytes) => { - console.log(bytes) - return WebAssembly.instantiate(bytes, {}) + console.log(bytes); + return WebAssembly.instantiate(bytes, {}); }) - .then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); \ No newline at end of file + .then((result) => { + const addResult = result.instance.exports.add(1, 2); + console.log(`1 + 2 = ${addResult}`); + return addResult; + }) + .then((addResult) => { + self.postMessage({ + status: 'initialized', + result: `1 + 2 = ${addResult}` + }); + }) + .catch((error) => { + console.error("An error occurred:", error); + self.postMessage({ + status: 'error', + error: error.message + }); + }); \ No newline at end of file