fixup! refactor(napi): use get_uv_event_loop instead of uv_default_loop
This commit is contained in:
parent
00454eb577
commit
1329409ca4
1 changed files with 13 additions and 14 deletions
|
@ -25,20 +25,19 @@ test('should execute future on libuv thread pool', async (t) => {
|
||||||
t.deepEqual(readFileSync(filepath), fileContent)
|
t.deepEqual(readFileSync(filepath), fileContent)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should execute future on libuv thread pool of "Worker"', async (t) => {
|
if (threadMod && napiVersion >= 4) {
|
||||||
// Test in threads if current Node.js supports "worker_threads".`
|
test('should execute future on libuv thread pool of "Worker"', async (t) => {
|
||||||
if (!threadMod || napiVersion < 4) {
|
// Test in threads if current Node.js supports "worker_threads".`
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const { Worker } = threadMod
|
const { Worker } = threadMod
|
||||||
const script = resolve(__dirname, './uv_worker.js')
|
const script = resolve(__dirname, './uv_worker.js')
|
||||||
const worker = new Worker(script)
|
const worker = new Worker(script)
|
||||||
const success = await new Promise((resolve) => {
|
const success = await new Promise((resolve) => {
|
||||||
worker.on('message', (success) => {
|
worker.on('message', (success) => {
|
||||||
resolve(success)
|
resolve(success)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
t.is(success, true)
|
t.is(success, true)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue