| 6 | const port = 7000; |
| 7 | |
| 8 | export async function assertBundlesJavaScriptWorker() { |
| 9 | const entry = './test/fixtures/worker.js'; |
| 10 | const code = ` |
| 11 | import { status } from './status.js'; |
| 12 | addEventListener('fetch', e => e.respondWith(new Response('', { status })));`; |
| 13 | await fs.outputFile(entry, code); |
| 14 | await fs.outputFile( |
| 15 | './test/fixtures/status.js', |
| 16 | 'export const status = 200;' |
| 17 | ); |
| 18 | const command = new RunCommand({ |
| 19 | entry, |
| 20 | port, |
| 21 | inspect: false, |
| 22 | watch: false, |
| 23 | check: false, |
| 24 | kv: [] |
| 25 | }); |
| 26 | await command.execute(); |
| 27 | const response = await fetch('http://localhost:7000'); |
| 28 | assert.equal(response.status, 200); |
| 29 | command.dispose(); |
| 30 | } |
| 31 | |
| 32 | export async function assertBundlesTypeScriptWorker() { |
| 33 | const entry = './test/fixtures/worker.ts'; |