diff --git a/tasks/coverage/snapshots/formatter_babel.snap b/tasks/coverage/snapshots/formatter_babel.snap index b8abb4cdeb533..780a68f354293 100644 --- a/tasks/coverage/snapshots/formatter_babel.snap +++ b/tasks/coverage/snapshots/formatter_babel.snap @@ -2,12 +2,10 @@ commit: 41d96516 formatter_babel Summary: AST Parsed : 2423/2423 (100.00%) -Positive Passed: 2419/2423 (99.83%) +Positive Passed: 2420/2423 (99.88%) Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/regression/13750/input.js Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2015/class/division/input.js -Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/top-level-await-unambiguous/module/input.js -`await` is only allowed within async functions and at the top levels of modules diff --git a/tasks/coverage/snapshots/formatter_typescript.snap b/tasks/coverage/snapshots/formatter_typescript.snap index 946ddfc830dc7..8776c37d74219 100644 --- a/tasks/coverage/snapshots/formatter_typescript.snap +++ b/tasks/coverage/snapshots/formatter_typescript.snap @@ -2,11 +2,9 @@ commit: 261630d6 formatter_typescript Summary: AST Parsed : 8816/8816 (100.00%) -Positive Passed: 8788/8816 (99.68%) +Positive Passed: 8790/8816 (99.71%) Mismatch: tasks/coverage/typescript/tests/cases/compiler/amdLikeInputDeclarationEmit.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/arrayFromAsync.ts -`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules`await` is only allowed within async functions and at the top levels of modules Mismatch: tasks/coverage/typescript/tests/cases/compiler/callOfConditionalTypeWithConcreteBranches.ts Mismatch: tasks/coverage/typescript/tests/cases/compiler/coAndContraVariantInferences3.ts @@ -39,8 +37,6 @@ Mismatch: tasks/coverage/typescript/tests/cases/compiler/tryStatementInternalCom Mismatch: tasks/coverage/typescript/tests/cases/compiler/unionSignaturesWithThisParameter.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts -Classes may not have a static property named prototypeClasses may not have a static property named prototypeClasses may not have a static property named prototypeClasses may not have a static property named prototypeClasses may not have a static property named prototypeClasses may not have a static property named prototype Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/controlFlow/controlFlowAssignmentPatternOrder.ts An implementation cannot be declared in ambient contexts. Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts diff --git a/tasks/coverage/src/tools/formatter.rs b/tasks/coverage/src/tools/formatter.rs index a09104ad7c449..888d4d08e65fc 100644 --- a/tasks/coverage/src/tools/formatter.rs +++ b/tasks/coverage/src/tools/formatter.rs @@ -28,8 +28,15 @@ fn get_result(source_text: &str, source_type: SourceType) -> TestResult { // `oxc_formatter` expects this to be false preserve_parens: false, }; - let ParserReturn { program, .. } = + + let ParserReturn { program, errors, .. } = Parser::new(&allocator, source_text, source_type).with_options(parse_options).parse(); + + // If the input has parse errors, we skip the test. + if !errors.is_empty() { + return TestResult::Passed; + } + let source_text1 = Formatter::new(&allocator, options.clone()).build(&program); let allocator = Allocator::default();