reproduce
Version:
Validate a package's reproducibility against it's published repository information.
49 lines (40 loc) โข 1.15 kB
JavaScript
/**
* 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();