const test = require('node:test'); const assert = require('node:assert/strict'); const {readFile} = require('node:fs/promises'); const {join} = require('node:path'); test('Piper worker is built and started as an ES module', async () => { const [buildScript, runtime] = await Promise.all([ readFile(join(__dirname, '..', 'scripts', 'build-piper.mjs'), 'utf8'), readFile(join(__dirname, '..', 'piper-runtime.js'), 'utf8'), ]); assert.match(buildScript, /outfile: join\(workerRoot, 'piper-worker\.js'\),\s*bundle: true,\s*format: 'esm'/); assert.match(runtime, /new Worker\(workerUrl, \{type: 'module'\}\)/); });