Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit e40b9d7

Browse files
committed
test: move ignores to node patching for abstract class
1 parent 2a5a782 commit e40b9d7

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

tests/ast-alignment/fixtures-to-test.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,6 @@ tester.addFixturePatternConfig('typescript/basics', {
314314
* TODO: remove me in next babel > 7.2.3
315315
*/
316316
'arrow-function-with-type-parameters',
317-
/**
318-
* Babel: ClassDeclaration + abstract: true
319-
* ts-estree: TSAbstractClassDeclaration
320-
*/
321-
'abstract-class-with-abstract-properties',
322-
/**
323-
* Babel: ClassProperty + abstract: true
324-
* ts-estree: TSAbstractClassProperty
325-
*/
326-
'abstract-class-with-abstract-readonly-property',
327317
/**
328318
* Babel: TSExpressionWithTypeArguments
329319
* ts-estree: ClassImplements
@@ -465,21 +455,7 @@ tester.addFixturePatternConfig('typescript/types', {
465455
});
466456

467457
tester.addFixturePatternConfig('typescript/declare', {
468-
fileType: 'ts',
469-
ignore: [
470-
/**
471-
* AST difference
472-
* ts-estree: heritage = []
473-
* babel: heritage = undefined
474-
*/
475-
'interface',
476-
/**
477-
* AST difference
478-
* ts-estree: TSAbstractClassDeclaration
479-
* babel: ClassDeclaration[abstract=true]
480-
*/
481-
'abstract-class'
482-
]
458+
fileType: 'ts'
483459
});
484460

485461
tester.addFixturePatternConfig('typescript/namespaces-and-modules', {

tests/ast-alignment/utils.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,26 @@ export function preprocessBabylonAST(ast: any): any {
231231
type: AST_NODE_TYPES.Identifier
232232
};
233233
}
234+
},
235+
/**
236+
* Babel: ClassDeclaration + abstract: true
237+
* ts-estree: TSAbstractClassDeclaration
238+
*/
239+
ClassDeclaration(node: any) {
240+
if (node.abstract) {
241+
node.type = 'TSAbstractClassDeclaration';
242+
delete node.abstract;
243+
}
244+
},
245+
/**
246+
* Babel: ClassProperty + abstract: true
247+
* ts-estree: TSAbstractClassProperty
248+
*/
249+
ClassProperty(node: any, parent: any) {
250+
if (node.abstract) {
251+
node.type = 'TSAbstractClassProperty';
252+
delete node.abstract;
253+
}
234254
}
235255
}
236256
);

0 commit comments

Comments
 (0)