Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add fixtures for exported classes with decorators #5558

Merged
merged 1 commit into from Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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",
}
`;