| 80 | } |
| 81 | |
| 82 | function printHelpAndExit(code: number): never { |
| 83 | // Keep this simple so `npm run benchmarks` works without extra args. |
| 84 | // Tuning: `--connections`, `--duration`, `--pipelining`, `--port`, `--path` |
| 85 | // Notes: The benchmark spawns the framework server as a child process and |
| 86 | // runs autocannon against it. |
| 87 | // |
| 88 | // eslint-disable-next-line no-console |
| 89 | console.log( |
| 90 | ` |
| 91 | Usage: |
| 92 | npm run benchmarks [-- --verbose] |
| 93 | npm run benchmarks [-- --connections 100] [-- --duration 10] [-- --pipelining 10] |
| 94 | npm run benchmarks [-- --port 3000] [-- --path /] |
| 95 | |
| 96 | Defaults: |
| 97 | verbose: ${DEFAULTS.verbose} |
| 98 | connections: ${DEFAULTS.connections} |
| 99 | duration: ${DEFAULTS.duration} |
| 100 | pipelining: ${DEFAULTS.pipelining} |
| 101 | port: ${DEFAULTS.port} |
| 102 | path: ${DEFAULTS.path} |
| 103 | `.trim(), |
| 104 | ); |
| 105 | process.exit(code); |
| 106 | } |
| 107 | |
| 108 | function frameworkEntry(framework: Framework): string { |
| 109 | return join(__dirname, '.', 'frameworks', framework); |