[BUG] Adding a new benchmark causes a `split` undefined error
FrancisMurillo opened this issue · 0 comments
FrancisMurillo commented
Description
Impacted PR: dotenv-linter/dotenv-linter#395
Given an existing benchmark exists, adding a new benchmark function causes an undefined JS error. Output taken from this run:
roup changes master
----- ------- ------
dotenv_linter check 1.05 65.1±3.38µs ? ?/sec 1.00 62.2±3.41µs ? ?/sec
dotenv_linter compare 1.00 27.2±1.46µs ? ?/sec
TypeError: Cannot read property 'split' of undefined
at /home/runner/work/_actions/boa-dev/criterion-compare-action/v2.0.0/dist/index.js:1:46988
at Array.map (<anonymous>)
at convertToMarkdown (/home/runner/work/_actions/boa-dev/criterion-compare-action/v2.0.0/dist/index.js:1:46732)
at main (/home/runner/work/_actions/boa-dev/criterion-compare-action/v2.0.0/dist/index.js:1:46106)
at async /home/runner/work/_actions/boa-dev/criterion-compare-action/v2.0.0/dist/index.js:1:47904
Error: Unhanded error:
TypeError: Cannot read property 'split' of undefined
Investigating the code and results, I believe the issue is that the output has trailing spaces breaking the undefined checks. A simple .trimRight
at this line could fix the issue:
// ORIGINAL
let resultLines = results.split("\n");
// NEW
let resultLines = results.trimRight().split("\n");
Will file a PR for this fix.