test(napi): skip worker tests in slow Docker env (#1569)

This commit is contained in:
LongYinan 2023-04-16 23:59:15 +08:00 committed by GitHub
parent d9ff0b4ddf
commit d9c191d270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,11 @@ import test from 'ava'
import { Animal, Kind, DEFAULT_COST } from '../index' import { Animal, Kind, DEFAULT_COST } from '../index'
test('should be able to require in worker thread', async (t) => { // aarch64-unknown-linux-gnu is extremely slow in CI, skip it or it will timeout
const t =
process.arch === 'arm64' && process.platform === 'linux' ? test.skip : test
t('should be able to require in worker thread', async (t) => {
await Promise.all( await Promise.all(
Array.from({ length: 100 }).map(() => { Array.from({ length: 100 }).map(() => {
const w = new Worker(join(__dirname, 'worker.js')) const w = new Worker(join(__dirname, 'worker.js'))
@ -27,7 +31,7 @@ test('should be able to require in worker thread', async (t) => {
) )
}) })
test('custom GC works on worker_threads', async (t) => { t('custom GC works on worker_threads', async (t) => {
await Promise.all( await Promise.all(
Array.from({ length: 50 }).map(() => Array.from({ length: 50 }).map(() =>
Promise.all([ Promise.all([
@ -66,7 +70,7 @@ test('custom GC works on worker_threads', async (t) => {
) )
}) })
test('should be able to new Class in worker thread concurrently', async (t) => { t('should be able to new Class in worker thread concurrently', async (t) => {
await Promise.all( await Promise.all(
Array.from({ length: 100 }).map(() => { Array.from({ length: 100 }).map(() => {
const w = new Worker(join(__dirname, 'worker.js')) const w = new Worker(join(__dirname, 'worker.js'))