use JSON.stringify to format counterexamples
This commit is contained in:
parent
d9d06eb469
commit
9ed06889f4
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mocha-foam",
|
"name": "mocha-foam",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"main": "out/src/index.js",
|
"main": "out/src/index.js",
|
||||||
"author": "ssube <seansube@gmail.com>",
|
"author": "ssube <seansube@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -82,13 +82,7 @@ export function briefReporter<T>(details: RunDetails<[T]>): string {
|
||||||
*/
|
*/
|
||||||
export function formatExamples<T>(details: RunDetails<[T]>): string {
|
export function formatExamples<T>(details: RunDetails<[T]>): string {
|
||||||
if (details.counterexample !== null) {
|
if (details.counterexample !== null) {
|
||||||
const examples = details.counterexample.map((val) => {
|
const examples = details.counterexample.map((val) => JSON.stringify(val)).join(',');
|
||||||
if (isString(val)) {
|
|
||||||
return `'${val}'`;
|
|
||||||
} else {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}).join(',');
|
|
||||||
return `failing on: ${examples} (seed: ${details.seed}, path: '${details.counterexamplePath}')`;
|
return `failing on: ${examples} (seed: ${details.seed}, path: '${details.counterexamplePath}')`;
|
||||||
} else {
|
} else {
|
||||||
return `without counterexamples (seed: ${details.seed})`;
|
return `without counterexamples (seed: ${details.seed})`;
|
||||||
|
|
Loading…
Reference in New Issue