2024-01-20 17:02:17 +01:00
|
|
|
import { spawnSync } from 'node:child_process'
|
|
|
|
import process from 'node:process'
|
2024-01-14 22:17:11 +01:00
|
|
|
|
|
|
|
// Import directly from file so that this script works without dependencies installed.
|
2024-01-20 17:02:17 +01:00
|
|
|
import { games } from './../lib/games.js'
|
2024-01-14 22:17:11 +01:00
|
|
|
|
2024-01-20 17:02:17 +01:00
|
|
|
const ID_TEST_BIN = process.env.GAMEDIG_ID_TESTER || 'gamedig-id-tests'
|
2024-01-14 22:17:11 +01:00
|
|
|
|
|
|
|
const result = spawnSync(ID_TEST_BIN, {
|
2024-01-20 17:02:17 +01:00
|
|
|
input: JSON.stringify(games),
|
|
|
|
stdio: ['pipe', 'inherit', 'inherit']
|
|
|
|
})
|
2024-01-14 22:17:11 +01:00
|
|
|
|
|
|
|
if (result.error) {
|
2024-01-20 17:02:17 +01:00
|
|
|
throw result.error
|
2024-01-14 22:17:11 +01:00
|
|
|
}
|
|
|
|
|
2024-01-20 17:02:17 +01:00
|
|
|
process.exit(result.status)
|