test-specific-tool.jsโข1.18 kB
#!/usr/bin/env node
/**
* Jest test runner for specific tools
* Usage: node scripts/test-specific-tool.js <tool_name>
*/
const { spawn } = require('child_process');
const toolName = process.argv[2];
if (!toolName) {
console.log(`
๐งช Jest Tool Test Runner
Usage: node scripts/test-specific-tool.js <tool_name>
Available Tools:
โข get_bug_details
โข search_bugs_by_keyword
โข search_bugs_by_product_id
โข search_bugs_by_product_and_release
โข search_bugs_by_product_series_affected
โข search_bugs_by_product_series_fixed
โข search_bugs_by_product_name_affected
โข search_bugs_by_product_name_fixed
Examples:
node scripts/test-specific-tool.js search_bugs_by_keyword
npm run test:jest-tool search_bugs_by_keyword
`);
process.exit(1);
}
// Convert tool name to test pattern
const testPattern = toolName.replace(/_/g, '.*');
console.log(`๐งช Running Jest tests for: ${toolName}`);
console.log(`๐ Test pattern: ${testPattern}`);
// Run Jest with the specific test pattern
const jest = spawn('npx', ['jest', '--testNamePattern', testPattern], {
stdio: 'inherit',
shell: true
});
jest.on('close', (code) => {
process.exit(code);
});