mirror of
https://github.com/hanzoai/viem.git
synced 2026-10-30 19:36:39 +00:00
26 lines
745 B
TypeScript
26 lines
745 B
TypeScript
import { Server } from 'prool/vitest'
|
|
import { inject } from 'vitest'
|
|
|
|
import { setConfig } from '../src/core/Errors.js'
|
|
|
|
setConfig({ version: '[email protected]' })
|
|
|
|
if (!process.env.OFFLINE) {
|
|
const { anvils, bundlers } = inject('coreServers')
|
|
const errors: unknown[] = []
|
|
for (const contexts of [Object.values(bundlers), Object.values(anvils)]) {
|
|
const results = await Promise.allSettled(
|
|
contexts.map((context) =>
|
|
Server.get(context).reset({ signal: AbortSignal.timeout(30_000) }),
|
|
),
|
|
)
|
|
errors.push(
|
|
...results.flatMap((result) =>
|
|
result.status === 'rejected' ? [result.reason] : [],
|
|
),
|
|
)
|
|
}
|
|
if (errors.length)
|
|
throw new AggregateError(errors, 'Failed to reset core servers.')
|
|
}
|