|
2 | 2 |
|
3 | 3 | const { fork } = require('child_process') |
4 | 4 | const { join } = require('path') |
5 | | -const getScrud = require('get-scrud') |
| 5 | +const { get } = require('axios') |
6 | 6 | const autocannon = require('autocannon') |
7 | 7 | const table = require('tty-table') |
8 | 8 | const ports = {http: 3010, fastify: 3011, polka: 3012, scrud: 3013, express: 3014} |
@@ -81,14 +81,15 @@ const bencher = (title) => new Promise((resolve, reject) => { |
81 | 81 | let last = {} |
82 | 82 | const checkConsistency = async (name) => { |
83 | 83 | let port = ports[name] |
84 | | - let { read } = getScrud(urlTemplate(port)) |
85 | | - let tmpRes = await read('bench', benchId) |
86 | | - if (!tmpRes || (last.lib && last.result !== tmpRes)) { |
| 84 | + let { data, headers } = await get(urlTemplate(port, true)) |
| 85 | + let isJSON = headers['content-type'].indexOf('application/json') !== -1 |
| 86 | + data = `${JSON.stringify(data)}-isJson:${isJSON}` |
| 87 | + if (!data || (last.lib && last.result !== data)) { |
87 | 88 | let err = new Error(`Got inconsistent results from libraries`) |
88 | | - err.meta = [`${last.lib} - ${last.result}`, `${name} - ${tmpRes}`] |
| 89 | + err.meta = [`${last.lib} - ${last.result}`, `${name} - ${data}`] |
89 | 90 | throw err |
90 | 91 | } |
91 | | - last = {lib: name, result: tmpRes} |
| 92 | + last = {lib: name, result: data} |
92 | 93 | } |
93 | 94 |
|
94 | 95 | const getEndMemory = (name) => new Promise((resolve, reject) => { |
|
0 commit comments