Files
wikideck/scripts/run-tests.mjs
T
eric 636f5b9c77 V2.1 (#21)
Working version Reviewed-on: #21
2026-11-01 22:07:51 +00:00

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;