Skip to content

Commit adda5f5

Browse files
committed
feat(tasks/coverage): ignore tests that have syntax error
1 parent ef0dedd commit adda5f5

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

tasks/coverage/snapshots/formatter_babel.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ commit: 41d96516
22

33
formatter_babel Summary:
44
AST Parsed : 2423/2423 (100.00%)
5-
Positive Passed: 2419/2423 (99.83%)
5+
Positive Passed: 2420/2423 (99.88%)
66
Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js
77

88
Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/regression/13750/input.js
99

1010
Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2015/class/division/input.js
1111

12-
Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/top-level-await-unambiguous/module/input.js
13-
`await` is only allowed within async functions and at the top levels of modules

tasks/coverage/snapshots/formatter_typescript.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ commit: 261630d6
22

33
formatter_typescript Summary:
44
AST Parsed : 8816/8816 (100.00%)
5-
Positive Passed: 8788/8816 (99.68%)
5+
Positive Passed: 8790/8816 (99.71%)
66
Mismatch: tasks/coverage/typescript/tests/cases/compiler/amdLikeInputDeclarationEmit.ts
77

8-
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/arrayFromAsync.ts
9-
`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
108
Mismatch: tasks/coverage/typescript/tests/cases/compiler/callOfConditionalTypeWithConcreteBranches.ts
119

1210
Mismatch: tasks/coverage/typescript/tests/cases/compiler/coAndContraVariantInferences3.ts
@@ -39,8 +37,6 @@ Mismatch: tasks/coverage/typescript/tests/cases/compiler/tryStatementInternalCom
3937

4038
Mismatch: tasks/coverage/typescript/tests/cases/compiler/unionSignaturesWithThisParameter.ts
4139

42-
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts
43-
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
4440
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/controlFlow/controlFlowAssignmentPatternOrder.ts
4541
An implementation cannot be declared in ambient contexts.
4642
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts

tasks/coverage/src/tools/formatter.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ fn get_result(source_text: &str, source_type: SourceType) -> TestResult {
2828
// `oxc_formatter` expects this to be false
2929
preserve_parens: false,
3030
};
31+
32+
let ParserReturn { program, errors, .. } =
3133
Parser::new(&allocator, source_text, source_type).with_options(parse_options).parse();
34+
35+
// If the input has parse errors, we skip the test.
36+
if !errors.is_empty() {
37+
return TestResult::Passed;
38+
}
39+
3240
let source_text1 = Formatter::new(&allocator, options.clone()).build(&program);
3341

3442
let allocator = Allocator::default();

0 commit comments

Comments
 (0)