0 Comments

 

 

 

If you use the standard HTML reporter for jasmine an expect like:

expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected));

would result in:

 

image

If you replace the div tag with a pre tag in the “jasmine-html.js” file.

image

 

 

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:

image

 

In some cases this will simplify, spotting the error in the JSON result.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts