Files
wehub-resource-sync f1ba9c6c36
/ test (push) Failing after 1s
/ build-and-push-to-ghcr (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:23:39 +08:00

47 lines
1.1 KiB
TypeScript

import 'reflect-metadata';
import { run } from 'node:test';
import { spec } from 'node:test/reporters';
import { glob } from 'node:fs';
import path from 'path';
import finalizer from '../build/services/finalizer.js';
import server from '../build/stand-alone/crawl.js';
process.env.NODE_ENV = 'test';
async function main() {
await server.serviceReady();
const files = await new Promise<string[]>((resolve, reject) => {
glob(path.join(__dirname, 'e2e', '*.test.js'), (err, found) => {
if (err) reject(err);
else resolve(found);
});
});
const stream = run({
files,
concurrency: false,
timeout: 10_000,
isolation: 'none',
forceExit: true,
watch: false,
});
stream.compose(spec).pipe(process.stdout);
let n = 0;
let i = 0;
stream.on('test:enqueue', () => {
i++;
});
stream.on('test:complete', () => {
n++;
if (n && i === n) {
process.nextTick(() => {
finalizer.teardown();
});
}
});
}
main();