Skip to content

Commit da8c5ee

Browse files
committed
test(ast/estree): ignore TS-ESTree tests where fail to parse (#10661)
Related to #9705. Skip tests in TS-ESTree conformance which do fail to parse, but fail because of bugs which are not related to ESTree serialization. We should eventually try to make these tests pass, but when we do, that'll show up in the parser conformance snapshots. So no need to repeat them in the ESTree conformance snapshot too - so we can more easily see what our ESTree-related problems are. Note: `typescript/tests/cases/conformance/jsx/jsxReactTestSuite.tsx` is *not* included in ignore list because that's not a fail in parser conformance (see #10578).
1 parent 2615758 commit da8c5ee

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

tasks/coverage/snapshots/estree_typescript.snap

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
commit: 15392346
22

33
estree_typescript Summary:
4-
AST Parsed : 6489/6493 (99.94%)
5-
Positive Passed: 6470/6493 (99.65%)
6-
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/arrayFromAsync.ts
7-
`await` is only allowed within async functions and at the top levels of modules
8-
4+
AST Parsed : 6487/6488 (99.98%)
5+
Positive Passed: 6470/6488 (99.72%)
96
Mismatch: tasks/coverage/typescript/tests/cases/compiler/controlFlowInstanceofWithSymbolHasInstance.ts
107

118
Mismatch: tasks/coverage/typescript/tests/cases/compiler/emitBundleWithShebang1.ts
@@ -22,20 +19,8 @@ Mismatch: tasks/coverage/typescript/tests/cases/compiler/shebang.ts
2219

2320
Mismatch: tasks/coverage/typescript/tests/cases/compiler/shebangBeforeReferences.ts
2421

25-
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/sourceMapValidationDecorators.ts
26-
Unexpected token
27-
28-
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts
29-
Classes may not have a static property named prototype
30-
31-
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/es2019/importMeta/importMeta.ts
32-
The only valid meta property for import is import.meta
33-
3422
Mismatch: tasks/coverage/typescript/tests/cases/conformance/es6/templates/templateStringMultiline3.ts
3523

36-
Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts
37-
Expected a semicolon or an implicit semicolon after a statement, but found none
38-
3924
Mismatch: tasks/coverage/typescript/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithRHSHasSymbolHasInstance.ts
4025

4126
Mismatch: tasks/coverage/typescript/tests/cases/conformance/expressions/typeGuards/typeGuardNarrowsPrimitiveIntersection.ts

tasks/coverage/src/tools/estree.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ impl Case for EstreeTest262Case {
7979
"test262/test/language/statements/for-of/head-lhs-cover.js",
8080
];
8181
82-
let path = &*self.path().to_string_lossy();
83-
if IGNORE_PATHS.contains(&path) {
82+
if self.path().to_str().is_some_and(|path| IGNORE_PATHS.contains(&path)) {
8483
return true;
8584
}
8685
*/
@@ -275,8 +274,32 @@ impl Case for EstreeTypescriptCase {
275274
}
276275

277276
fn skip_test_case(&self) -> bool {
278-
// Skip cases where expected to fail to parse, or no JSON file for case in `acorn-test262`
279-
self.base.should_fail() || matches!(fs::exists(&self.estree_file_path), Ok(false))
277+
// Skip cases where expected to fail to parse
278+
if self.base.should_fail() {
279+
return true;
280+
}
281+
282+
// Skip cases which are failing in parser conformance tests.
283+
// Some of these should parse correctly, but the cause is not related to ESTree serialization,
284+
// so they're not relevant here. If we fix them, that'll register in the parser snapshot.
285+
// TODO: If we fix any of these in parser, remove them from the list below.
286+
#[expect(clippy::items_after_statements)]
287+
static IGNORE_PATHS: &[&str] = &[
288+
// Fails because fixture is not loaded as an ESM module (bug in tester)
289+
"typescript/tests/cases/compiler/arrayFromAsync.ts",
290+
// Differences between TS's recoverable parser and Oxc's non-recoverable parser
291+
"typescript/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts",
292+
"typescript/tests/cases/conformance/es2019/importMeta/importMeta.ts",
293+
// Decorators - probably should be parsed correctly (bug in parser)
294+
"typescript/tests/cases/compiler/sourceMapValidationDecorators.ts",
295+
"typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts",
296+
];
297+
if self.path().to_str().is_some_and(|path| IGNORE_PATHS.contains(&path)) {
298+
return true;
299+
}
300+
301+
// Skip cases where no JSON file for case in `acorn-test262`
302+
matches!(fs::exists(&self.estree_file_path), Ok(false))
280303
}
281304

282305
fn run(&mut self) {

0 commit comments

Comments
 (0)