From 9ed06889f49f59a9b91b27afe14b35a888251221 Mon Sep 17 00:00:00 2001 From: ssube Date: Sat, 24 Jul 2021 14:45:45 -0500 Subject: [PATCH] use JSON.stringify to format counterexamples --- package.json | 2 +- src/index.ts | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 2cb666b..b77c52d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mocha-foam", - "version": "0.1.1", + "version": "0.1.2", "main": "out/src/index.js", "author": "ssube ", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index 7197113..a7e5100 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,13 +82,7 @@ export function briefReporter(details: RunDetails<[T]>): string { */ export function formatExamples(details: RunDetails<[T]>): string { if (details.counterexample !== null) { - const examples = details.counterexample.map((val) => { - if (isString(val)) { - return `'${val}'`; - } else { - return val; - } - }).join(','); + const examples = details.counterexample.map((val) => JSON.stringify(val)).join(','); return `failing on: ${examples} (seed: ${details.seed}, path: '${details.counterexamplePath}')`; } else { return `without counterexamples (seed: ${details.seed})`;