Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Sep 25, 2024
1 parent 6be0b3f commit f926b9b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions openrewrite/test/javascript/parser/testHarness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ const parser = JavaScriptParser.builder().build();

export function javaScript(before: string, spec?: (sourceFile: JS.CompilationUnit) => void): SourceSpec {
return (options: RewriteTestOptions) => {
const normalizeIndent = options.normalizeIndent === undefined || options.normalizeIndent;
const [sourceFile] = parser.parseStrings(normalizeIndent ? dedent(before) : before) as Iterable<JS.CompilationUnit>;
if (options.validatePrintIdempotence === undefined || options.validatePrintIdempotence) {
const [sourceFile] = parser.parseStrings(options.normalizeIndent ?? true ? dedent(before) : before) as Iterable<JS.CompilationUnit>;
if (options.validatePrintIdempotence ?? true) {
let printed = print(sourceFile);
expect(printed).toBe(before);
}
Expand Down

0 comments on commit f926b9b

Please sign in to comment.