23 November, 2015
0 Comments
1 category
If you use the standard HTML reporter for jasmine an expect like:
expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected));
would result in:
If you replace the div tag with a pre tag in the “jasmine-html.js” file.
and use the third paramater of the JSON.stringify method to pretty print the JSON,
like:
expect(JSON.stringify(actual, null, 4)).toEqual(JSON.stringify(expected, null, 4));
the result will be:
In some cases this will simplify, spotting the error in the JSON result.
Tags: JasmineJavascript
Category: Uncategorized