From c07a3620ac50e8f23798d4977665bc00bb22373b Mon Sep 17 00:00:00 2001 From: Michele Togni <5522419+MicheleTogni@users.noreply.github.com> Date: Wed, 25 May 2022 06:29:55 +0200 Subject: [PATCH] Bugfix for "Error: TypeError: Cannot read properties of undefined (reading 'trim')" (#18) * More robust output cleaning * added comment --- src/utils/tests_parsers.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/utils/tests_parsers.ts b/src/utils/tests_parsers.ts index 27f28e7..3e2d0d0 100644 --- a/src/utils/tests_parsers.ts +++ b/src/utils/tests_parsers.ts @@ -16,8 +16,10 @@ export interface ParseOutput { // Used by load method, does not evaluate whether tests have passed/failed. export function parseMixOutput(projectDir: string, stdout: string): Map { const testsMap = new Map(); - const tests = stdout - .split('Including tags: [:""]')[1] // compilation and other noise before + + const cleanOutput = cleanupOutput(stdout); + + const tests = cleanOutput .trim() .split('\n\n') // tests grouped per files .map((string) => string.split('\n').filter((string) => string)) // sometimes there are no tests, like an empty doctest @@ -64,3 +66,10 @@ export function parseMixOutput(projectDir: string, stdout: string): Map