Replace text summary generation with JS code
Closed this issue · 1 comments
After #1788 and #1768, there's no need to generate the end-of-test text summary with Go code anymore. Indeed, the JSON summary is now generated by a JS function. However, because the last-minute replacement of the battle-tested Go summary generation with an untested JavaScript one is risky, we decided to postpone it to k6 v0.31.0.
For now the replacement code lives in https://gist.github.com/na--/eaf6540fae765499cbfddce1a052583f, and we'll deploy it to https://jslib.k6.io with the v0.30.0 release, so it can be used in handleSummary()
. But at some point in the v0.31.0 cycle, we should bundle it in k6 and drop the old Go code. Ideally, with go.rice (or other Go bundler), so future bugfixes can be easily copied from the jslib version to it, or vice versa.
#1805 is a prerequisite for this issue. We can do it without it, but it would be a bit of a hack.
Alpha version of the JS-based summary helpers is live at https://jslib.k6.io/k6-summary/0.0.1/index.js (GitHub link is https://github.com/loadimpact/jslib.k6.io/tree/master/lib/k6-summary), though as I said in grafana/jslib.k6.io#20, it could definitely use some improvements.