From 0b76767b5862a57946c853b5fbfe4cf7018da388 Mon Sep 17 00:00:00 2001 From: Weicheng Zhao <106119275+sfc-gh-wzhao@users.noreply.github.com> Date: Sun, 17 Sep 2023 11:22:54 -0700 Subject: [PATCH] Fix `Illegal argument: line must be non-negative` (#425) Co-authored-by: Ryan Luker --- src/coverage-system/renderer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coverage-system/renderer.ts b/src/coverage-system/renderer.ts index 830f210..6edf767 100644 --- a/src/coverage-system/renderer.ts +++ b/src/coverage-system/renderer.ts @@ -117,7 +117,7 @@ export class Renderer { return; } section.lines.details - .filter((detail) => detail.line >= 0) + .filter((detail) => detail.line > 0) .forEach((detail) => { const lineRange = new Range(detail.line - 1, 0, detail.line - 1, 0); if (detail.hit > 0) { @@ -143,7 +143,7 @@ export class Renderer { return; } section.branches.details - .filter((detail) => detail.taken === 0 && detail.line >= 0) + .filter((detail) => detail.taken === 0 && detail.line > 0) .forEach((detail) => { const partialRange = new Range(detail.line - 1, 0, detail.line - 1, 0); // Evaluates to true if at least one element in range is equal to partialRange