UNPKG

reproduce

Version:

Validate a package's reproducibility against it's published repository information.

49 lines (40 loc) โ€ข 1.15 kB
#!/usr/bin/env node /** * Test runner for reproduce * * This script runs all the tests for the reproduce package. */ import { spawn } from 'node:child_process'; import { fileURLToPath } from 'node:url'; import { dirname, join } from 'node:path'; const __dirname = dirname(fileURLToPath(import.meta.url)); console.log('๐Ÿงช Running reproduce tests...\n'); // Helper function to run a test file async function runTest(testFile) { return new Promise((resolve, reject) => { const testProcess = spawn('node', ['--test', '--no-warnings', testFile], { stdio: 'inherit', cwd: process.cwd() }); testProcess.on('close', (code) => { if (code === 0) { resolve(); } else { reject(new Error(`Test failed with exit code ${code}`)); } }); }); } // Run all tests async function runAllTests() { try { console.log('๐Ÿ“‹ Running tests...'); await runTest(join(__dirname, 'test.js')); console.log('โœ… All tests passed!\n'); console.log('๐ŸŽ‰ Test suite completed successfully!'); } catch (error) { console.error(error.message); process.exit(1); } } runAllTests();