Skip to content

Commit

Permalink
fixing AST comparison tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Janther committed Aug 25, 2024
1 parent 4ceae94 commit 453c6a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/clean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Prettier offers a clean way to define ignored properties.
const ignoredProperties = new Set(['loc', 'range', 'comments']);
const ignoredProperties = new Set([
'loc',
'range',
'comments',
// this function is defined at constructor time so it won't pass AST
// comparisons.
'cleanModifierInvocationArguments'
]);
// eslint-disable-next-line @typescript-eslint/no-empty-function
function clean(/* ast, newObj, parent */): void {}
clean.ignoredProperties = ignoredProperties;
Expand Down
4 changes: 1 addition & 3 deletions tests/config/run-format-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,7 @@ async function runTest({
if (isAstUnstableTest) {
expect(formattedAst).not.toEqual(originalAst);
} else {
expect(JSON.parse(JSON.stringify(formattedAst))).toEqual(
JSON.parse(JSON.stringify(originalAst)),
);
expect(formattedAst).toEqual(originalAst);
}
}

Expand Down

0 comments on commit 453c6a1

Please sign in to comment.