1
0
Fork 0

use JSON.stringify to format counterexamples

This commit is contained in:
ssube 2021-07-24 14:45:45 -05:00
parent d9d06eb469
commit 9ed06889f4
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 2 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "mocha-foam",
"version": "0.1.1",
"version": "0.1.2",
"main": "out/src/index.js",
"author": "ssube <seansube@gmail.com>",
"license": "MIT",

View File

@ -82,13 +82,7 @@ export function briefReporter<T>(details: RunDetails<[T]>): string {
*/
export function formatExamples<T>(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})`;