@gv-sh/specgen-server
Version:
SpecGen Server - API for Speculative Fiction Generator
29 lines (24 loc) ⢠790 B
JavaScript
// runTests.js
const { spawn } = require('child_process');
// Run the tests
function runTests() {
return new Promise((resolve) => {
console.log('\nš Running tests...');
console.log('--------------------------------------------------');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const child = spawn(npm, ['test'], { stdio: 'inherit' });
child.on('close', (code) => {
console.log('--------------------------------------------------');
if (code === 0) {
console.log('ā
Tests completed successfully');
resolve(true);
} else {
console.log(`ā Tests failed with code ${code}`);
resolve(false);
}
});
});
}
runTests().then((success) => {
process.exit(success ? 0 : 1);
});