Skip to content

Commit

Permalink
Allow updating invalid JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 10, 2021
1 parent 2191ea2 commit ecafa9e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/helper/test-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ class TokenizeJSONRunner {
*/
isEqual(actual, expected) {
const simplifiedActual = TokenStreamTransformer.simplify(actual);
const simplifiedExpected = JSON.parse(expected);
let simplifiedExpected;
try {
simplifiedExpected = JSON.parse(expected);
} catch (error) {
return false;
}

return JSON.stringify(simplifiedActual) === JSON.stringify(simplifiedExpected);
}
Expand All @@ -197,7 +202,6 @@ class TokenizeJSONRunner {
const simplifiedActual = TokenStreamTransformer.simplify(actual);
const simplifiedExpected = JSON.parse(expected);


const actualString = JSON.stringify(simplifiedActual);
const expectedString = JSON.stringify(simplifiedExpected);

Expand Down

0 comments on commit ecafa9e

Please sign in to comment.