19 lines
738 B
JavaScript
Executable File
19 lines
738 B
JavaScript
Executable File
import { readdirSync } from 'node:fs';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { join } from 'node:path';
|
|
|
|
const testDirectory = fileURLToPath(new URL('../tests/', import.meta.url));
|
|
const files = readdirSync(testDirectory)
|
|
.filter(name => name.endsWith('.test.ts'))
|
|
.sort()
|
|
.map(name => join(testDirectory, name));
|
|
if (!files.length) throw new Error('No test files found.');
|
|
|
|
const result = spawnSync(process.execPath, ['--import', 'tsx', '--test', ...files], {
|
|
stdio: 'inherit',
|
|
env: { ...process.env, WIKIDECK_NETWORK: 'testnet', WIKIDECK_GENESIS_TIME: '1792411200' },
|
|
});
|
|
if (result.error) throw result.error;
|
|
process.exitCode = result.status ?? 1;
|