diff --git a/tasks/coverage/snapshots/formatter_babel.snap b/tasks/coverage/snapshots/formatter_babel.snap index 6592d0fe21233..b00aae02ba93e 100644 --- a/tasks/coverage/snapshots/formatter_babel.snap +++ b/tasks/coverage/snapshots/formatter_babel.snap @@ -2,10 +2,16 @@ commit: 41d96516 formatter_babel Summary: AST Parsed : 2423/2423 (100.00%) -Positive Passed: 2420/2423 (99.88%) -Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js +Positive Passed: 2417/2423 (99.75%) +Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js -Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/regression/13750/input.js +Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/regression/13750/input.js -Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2015/class/division/input.js +Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/sourcetype-commonjs/top-level-return/input.js +A 'return' statement can only be used within a function body. +Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/sourcetype-commonjs/top-level-return-asi/input.js +A 'return' statement can only be used within a function body. +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_misc.snap b/tasks/coverage/snapshots/formatter_misc.snap index a2ab4a28f2016..cb23e752f2e8e 100644 --- a/tasks/coverage/snapshots/formatter_misc.snap +++ b/tasks/coverage/snapshots/formatter_misc.snap @@ -1,9 +1,11 @@ formatter_misc Summary: AST Parsed : 49/49 (100.00%) -Positive Passed: 46/49 (93.88%) -Expect to Parse: tasks/coverage/misc/pass/oxc-12612.ts +Positive Passed: 45/49 (91.84%) +Expect to Parse: tasks/coverage/misc/pass/oxc-11487.cjs +Cannot use `await` as an identifier in an async context +Mismatch: tasks/coverage/misc/pass/oxc-12612.ts -Expect to Parse: tasks/coverage/misc/pass/oxc-2592.ts +Mismatch: tasks/coverage/misc/pass/oxc-2592.ts Expect to Parse: tasks/coverage/misc/pass/oxc-4449.ts - +Computed property names are not allowed in enums. diff --git a/tasks/coverage/snapshots/formatter_test262.snap b/tasks/coverage/snapshots/formatter_test262.snap index d04e81297e29d..f42db7356bf3b 100644 --- a/tasks/coverage/snapshots/formatter_test262.snap +++ b/tasks/coverage/snapshots/formatter_test262.snap @@ -2,10 +2,12 @@ commit: baa48a41 formatter_test262 Summary: AST Parsed : 44517/44517 (100.00%) -Positive Passed: 44514/44517 (99.99%) -Expect to Parse: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js +Positive Passed: 44513/44517 (99.99%) +Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js -Expect to Parse: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js +Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js -Expect to Parse: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js +Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js +Expect to Parse: tasks/coverage/test262/test/language/expressions/in/private-field-rhs-yield-present.js +Cannot use `yield` as an identifier in a generator context diff --git a/tasks/coverage/snapshots/formatter_typescript.snap b/tasks/coverage/snapshots/formatter_typescript.snap index f984274b4845c..77c9382da375f 100644 --- a/tasks/coverage/snapshots/formatter_typescript.snap +++ b/tasks/coverage/snapshots/formatter_typescript.snap @@ -2,120 +2,126 @@ commit: 261630d6 formatter_typescript Summary: AST Parsed : 8816/8816 (100.00%) -Positive Passed: 8758/8816 (99.34%) +Positive Passed: 8755/8816 (99.31%) Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/APISample_jsdoc.ts +Expected `]` but found `:` +Mismatch: tasks/coverage/typescript/tests/cases/compiler/amdLikeInputDeclarationEmit.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/amdLikeInputDeclarationEmit.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/callOfConditionalTypeWithConcreteBranches.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 Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/castExpressionParentheses.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/compiler/coAndContraVariantInferences3.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/coAndContraVariantInferences3.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/complexNarrowingWithAny.ts +Mismatch: tasks/coverage/typescript/tests/cases/compiler/complexNarrowingWithAny.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/declarationEmitCastReusesTypeNode4.ts +Mismatch: tasks/coverage/typescript/tests/cases/compiler/declarationEmitCastReusesTypeNode4.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/declarationEmitPartialReuseComputedProperty.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/declarationEmitPromise.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/compiler/declarationEmitRecursiveConditionalAliasPreserved.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/declarationEmitRecursiveConditionalAliasPreserved.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/declarationEmitShadowingInferNotRenamed.ts +Mismatch: tasks/coverage/typescript/tests/cases/compiler/declarationEmitShadowingInferNotRenamed.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/exportDefaultParenthesizeES6.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceGlobalReexport.tsx -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceGlobalReexport.tsx +Mismatch: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.tsx -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.tsx - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceImplicitImportJSXNamespace.tsx +Mismatch: tasks/coverage/typescript/tests/cases/compiler/jsxNamespaceImplicitImportJSXNamespace.tsx Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/keyRemappingKeyofResult.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/narrowingByTypeofInSwitch.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/propertyAccessExpressionInnerComments.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/compiler/propertyAccessExpressionInnerComments.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts - +Expected `{` but found `as` Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/reducibleIndexedAccessTypes.ts - +Expected `]` but found `:` Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/reverseMappedTypeInferenceSameSource1.ts +An implementation cannot be declared in ambient contexts. +Mismatch: tasks/coverage/typescript/tests/cases/compiler/sourceMapValidationClasses.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/sourceMapValidationClasses.ts +Mismatch: tasks/coverage/typescript/tests/cases/compiler/styledComponentsInstantiaionLimitNotReached.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/styledComponentsInstantiaionLimitNotReached.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/substitutionTypeForIndexedAccessType2.ts +Mismatch: tasks/coverage/typescript/tests/cases/compiler/substitutionTypeForIndexedAccessType2.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/superAccessCastedCall.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/tryStatementInternalComments.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/compiler/tryStatementInternalComments.ts Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/typeName1.ts +Expected `]` but found `:` +Mismatch: tasks/coverage/typescript/tests/cases/compiler/unionSignaturesWithThisParameter.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/unionSignaturesWithThisParameter.ts - +Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/overrideInterfaceProperty.ts +'readonly' type modifier is only permitted on array and tuple literal types. Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/staticAutoAccessorsWithDecorators.ts - +Unexpected token +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/decorators/class/decoratorChecksFunctionBodies.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts - +Cannot use `yield` as an identifier in a generator context Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts - +Cannot use `yield` as an identifier in a generator contextUnexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.2.ts - +Expected `{` but found `as` Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.2.ts - +Expected `{` but found `as` Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts - +Decorators are not valid here.Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts - +Decorators are not valid here.Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.2.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/asOperator/asOpEmitParens.ts - +Expected a semicolon or an implicit semicolon after a statement, but found none Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/optionalChaining/optionalChainingInTypeAssertions.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts +Mismatch: tasks/coverage/typescript/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/externalModules/topLevelAwait.1.ts - +Cannot use `await` as an identifier in an async contextUnexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/generators/yieldStatementNoAsiAfterTransform.ts +Expected a semicolon or an implicit semicolon after a statement, but found none +Mismatch: tasks/coverage/typescript/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts +Mismatch: tasks/coverage/typescript/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts - +Expected `]` but found `:` Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/returnStatements/returnStatementNoAsiAfterTransform.ts - +Expected `,` but found `(` Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts - +Expected `]` but found `:` Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts - +'static' modifier cannot appear on a type member.'static' modifier cannot appear on a type member. Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/rest/genericObjectRest.ts - -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/tuple/named/namedTupleMembers.ts +Unexpected token +Mismatch: tasks/coverage/typescript/tests/cases/conformance/types/tuple/named/namedTupleMembers.ts Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts - +Unexpected token Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts - +Unexpected token diff --git a/tasks/coverage/src/tools/formatter.rs b/tasks/coverage/src/tools/formatter.rs index a8279b69f7d5e..773b892343e30 100644 --- a/tasks/coverage/src/tools/formatter.rs +++ b/tasks/coverage/src/tools/formatter.rs @@ -26,14 +26,22 @@ fn get_result(source_text: &str, source_type: SourceType) -> TestResult { let source_text1 = Formatter::new(&allocator, options.clone()).build(&program); let allocator = Allocator::default(); - let ParserReturn { program, .. } = + let ParserReturn { program, errors, .. } = Parser::new(&allocator, &source_text1, source_type).with_options(parse_options).parse(); + + if !errors.is_empty() { + return TestResult::ParseError( + errors.iter().map(std::string::ToString::to_string).collect(), + false, + ); + } + let source_text2 = Formatter::new(&allocator, options).build(&program); if source_text1 == source_text2 { TestResult::Passed } else { - TestResult::ParseError(String::new(), false) + TestResult::Mismatch("Mismatch", source_text1, source_text2) } }