blob: fbdb9bf0ece9be2eca0af32f6b316944c3d55358 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import { WPTRunner } from './runner/runner.mjs'
import { join } from 'path'
import { fileURLToPath } from 'url'
import { fork } from 'child_process'
import { on } from 'events'
const { WPT_REPORT } = process.env
const serverPath = fileURLToPath(join(import.meta.url, '../server/server.mjs'))
const child = fork(serverPath, [], {
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
})
child.on('exit', (code) => process.exit(code))
for await (const [message] of on(child, 'message')) {
if (message.server) {
const runner = new WPTRunner('mimesniff', message.server, {
appendReport: !!WPT_REPORT,
reportPath: WPT_REPORT
})
runner.run()
runner.once('completion', () => {
if (child.connected) {
child.send('shutdown')
}
})
}
}
|