Skip to content

Commit 453c6a1

Browse files
committed
fixing AST comparison tests
1 parent 4ceae94 commit 453c6a1

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/clean.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// Prettier offers a clean way to define ignored properties.
2-
const ignoredProperties = new Set(['loc', 'range', 'comments']);
2+
const ignoredProperties = new Set([
3+
'loc',
4+
'range',
5+
'comments',
6+
// this function is defined at constructor time so it won't pass AST
7+
// comparisons.
8+
'cleanModifierInvocationArguments'
9+
]);
310
// eslint-disable-next-line @typescript-eslint/no-empty-function
411
function clean(/* ast, newObj, parent */): void {}
512
clean.ignoredProperties = ignoredProperties;

tests/config/run-format-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,7 @@ async function runTest({
358358
if (isAstUnstableTest) {
359359
expect(formattedAst).not.toEqual(originalAst);
360360
} else {
361-
expect(JSON.parse(JSON.stringify(formattedAst))).toEqual(
362-
JSON.parse(JSON.stringify(originalAst)),
363-
);
361+
expect(formattedAst).toEqual(originalAst);
364362
}
365363
}
366364

0 commit comments

Comments
 (0)