Skip to content

Commit

Permalink
test: add fixtures for exported classes with decorators (#5558)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Aug 29, 2022
1 parent 96b615a commit 14b33a4
Show file tree
Hide file tree
Showing 6 changed files with 561 additions and 0 deletions.
@@ -0,0 +1,2 @@
@sealed
export default class Qux {}
@@ -0,0 +1,2 @@
@sealed
export class Qux {}
Expand Up @@ -437,6 +437,14 @@ tester.addFixturePatternConfig('typescript/decorators/accessor-decorators', {
});
tester.addFixturePatternConfig('typescript/decorators/class-decorators', {
fileType: 'ts',
ignore: [
/**
* babel sets the range of the export node to the start of the decorator
* TSESTree sets it to the start of the export keyword
*/
'export-default-class-decorator',
'export-named-class-decorator',
],
});
tester.addFixturePatternConfig('typescript/decorators/method-decorators', {
fileType: 'ts',
Expand Down
Expand Up @@ -2224,6 +2224,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/class-decorator-factory.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/export-default-class-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/export-named-class-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down
@@ -0,0 +1,280 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`typescript decorators class-decorators export-default-class-decorator.src 1`] = `
Object {
"body": Array [
Object {
"declaration": Object {
"body": Object {
"body": Array [],
"loc": Object {
"end": Object {
"column": 27,
"line": 2,
},
"start": Object {
"column": 25,
"line": 2,
},
},
"range": Array [
33,
35,
],
"type": "ClassBody",
},
"decorators": Array [
Object {
"expression": Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
"column": 1,
"line": 1,
},
},
"name": "sealed",
"range": Array [
1,
7,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
7,
],
"type": "Decorator",
},
],
"id": Object {
"loc": Object {
"end": Object {
"column": 24,
"line": 2,
},
"start": Object {
"column": 21,
"line": 2,
},
},
"name": "Qux",
"range": Array [
29,
32,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 27,
"line": 2,
},
"start": Object {
"column": 15,
"line": 2,
},
},
"range": Array [
23,
35,
],
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 27,
"line": 2,
},
"start": Object {
"column": 0,
"line": 2,
},
},
"range": Array [
8,
35,
],
"type": "ExportDefaultDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
"line": 3,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
36,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
"column": 1,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
1,
],
"type": "Punctuator",
"value": "@",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
"column": 1,
"line": 1,
},
},
"range": Array [
1,
7,
],
"type": "Identifier",
"value": "sealed",
},
Object {
"loc": Object {
"end": Object {
"column": 6,
"line": 2,
},
"start": Object {
"column": 0,
"line": 2,
},
},
"range": Array [
8,
14,
],
"type": "Keyword",
"value": "export",
},
Object {
"loc": Object {
"end": Object {
"column": 14,
"line": 2,
},
"start": Object {
"column": 7,
"line": 2,
},
},
"range": Array [
15,
22,
],
"type": "Keyword",
"value": "default",
},
Object {
"loc": Object {
"end": Object {
"column": 20,
"line": 2,
},
"start": Object {
"column": 15,
"line": 2,
},
},
"range": Array [
23,
28,
],
"type": "Keyword",
"value": "class",
},
Object {
"loc": Object {
"end": Object {
"column": 24,
"line": 2,
},
"start": Object {
"column": 21,
"line": 2,
},
},
"range": Array [
29,
32,
],
"type": "Identifier",
"value": "Qux",
},
Object {
"loc": Object {
"end": Object {
"column": 26,
"line": 2,
},
"start": Object {
"column": 25,
"line": 2,
},
},
"range": Array [
33,
34,
],
"type": "Punctuator",
"value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 27,
"line": 2,
},
"start": Object {
"column": 26,
"line": 2,
},
},
"range": Array [
34,
35,
],
"type": "Punctuator",
"value": "}",
},
],
"type": "Program",
}
`;

0 comments on commit 14b33a4

Please sign in to comment.