8000 test(typescript-estree): update babel alignment tests (#3024) · patternleaf/typescript-eslint@837572f · GitHub
[go: up one dir, main page]

Skip to content

Commit 837572f

Browse files
authored
test(typescript-estree): update babel alignment tests (typescript-eslint#3024)
1 parent 552b9a6 commit 837572f

File tree

4 files changed

+153
-161
lines changed

4 files changed

+153
-161
lines changed

packages/typescript-estree/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
"tsutils": "^3.17.1"
5151
},
5252
"devDependencies": {
53-
"@babel/code-frame": "^7.12.11",
53+
"@babel/code-frame": "^7.12.13",
5454
"@babel/parser": "^7.12.15",
55-
"@babel/types": "^7.12.12",
55+
"@babel/types": "^7.12.13",
5656
"@types/babel__code-frame": "^7.0.2",
5757
"@types/debug": "*",
5858
"@types/glob": "*",

packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,7 @@ tester.addFixturePatternConfig('typescript/basics', {
342342
*/
343343
'interface-with-extends-member-expression',
344344
/**
345-
* Was expected to be fixed by PR into Babel: https://github.com/babel/babel/pull/9302
346-
* But not fixed in Babel 7.3
347-
* TODO: Investigate differences
345+
* https://github.com/typescript-eslint/typescript-eslint/issues/2998
348346
*/
349347
'type-import-type',
350348
'type-import-type-with-type-parameters-in-type-reference',
@@ -371,30 +369,24 @@ tester.addFixturePatternConfig('typescript/basics', {
371369
*/
372370
'export-named-enum-computed-string',
373371
/**
374-
* Babel: TSTypePredicate includes `:` statement in range
375-
* ts-estree: TSTypePredicate does not include `:` statement in range
376-
* https://github.com/babel/babel/issues/12676
372+
* Babel: TSTypePredicate does not include `asserts` statement in range
373+
* ts-estree: TSTypePredicate does include `asserts` statement in range
374+
* https://github.com/babel/babel/pull/12763
377375
*/
378-
'type-assertion-in-arrow-function',
379-
'type-assertion-in-function',
380-
'type-assertion-in-interface',
381-
'type-assertion-in-method',
382-
'type-assertion-with-guard-in-arrow-function',
383-
'type-assertion-with-guard-in-function',
384-
'type-assertion-with-guard-in-interface',
385376
'type-assertion-with-guard-in-method',
386-
'type-guard-in-arrow-function',
387-
'type-guard-in-function',
388-
'type-guard-in-interface',
389377
/**
390378
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
391379
* This is intentional; we don't error on semantic problems for these cases
392380
*/
393381
'class-with-constructor-and-type-parameters',
394382
'class-with-two-methods-computed-constructor',
395-
'catch-clause-with-invalid-annotation',
396383
'export-type-star-from',
397384
'import-type-error',
385+
/**
386+
* [TS-ESTREE ERRORED, BUT BABEL DID NOT]
387+
* TODO: report this to babel
388+
*/
389+
'catch-clause-with-invalid-annotation',
398390
/**
399391
* babel does not take into account leading character into union and intersection
400392
* https://github.com/babel/babel/pull/12758

packages/typescript-estree/tests/ast-alignment/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any {
151151
};
152152
}
153153
},
154+
TSTypePredicate(node) {
155+
if (!node.typeAnnotation) {
156+
node.typeAnnotation = null;
157+
}
158+
},
154159
MethodDefinition(node) {
155160
/**
156161
* Babel: MethodDefinition + abstract: true

0 commit comments

Comments
 (0)
0