Skip to content

test(ts-estree): add regression test for decorators on variables #186

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

Merged
merged 1 commit into from
Feb 2, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
244 changes: 244 additions & 0 deletions packages/parser/tests/lib/__snapshots__/typescript.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -89541,6 +89541,250 @@ Object {
}
`;

exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = `
Object {
"body": Array [
Object {
"declarations": Array [
Object {
"id": Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 2,
},
"start": Object {
"column": 6,
"line": 2,
},
},
"name": "a",
"range": Array [
14,
15,
],
"type": "Identifier",
},
"init": Object {
"loc": Object {
"end": Object {
"column": 11,
"line": 2,
},
"start": Object {
"column": 10,
"line": 2,
},
},
"range": Array [
18,
19,
],
"raw": "1",
"type": "Literal",
"value": 1,
},
"loc": Object {
"end": Object {
"column": 11,
"line": 2,
},
"start": Object {
"column": 6,
"line": 2,
},
},
"range": Array [
14,
19,
],
"type": "VariableDeclarator",
},
],
"kind": "const",
"loc": Object {
"end": Object {
"column": 11,
"line": 2,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
19,
],
"type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
"line": 3,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
20,
],
"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": 5,
"line": 1,
},
"start": Object {
"column": 1,
"line": 1,
},
},
"range": Array [
1,
5,
],
"type": "Identifier",
"value": "deco",
},
Object {
"loc": Object {
"end": Object {
"column": 6,
"line": 1,
},
"start": Object {
"column": 5,
"line": 1,
},
},
"range": Array [
5,
6,
],
"type": "Punctuator",
"value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
"column": 6,
"line": 1,
},
},
"range": Array [
6,
7,
],
"type": "Punctuator",
"value": ")",
},
Object {
"loc": Object {
"end": Object {
"column": 5,
"line": 2,
},
"start": Object {
"column": 0,
"line": 2,
},
},
"range": Array [
8,
13,
],
"type": "Keyword",
"value": "const",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 2,
},
"start": Object {
"column": 6,
"line": 2,
},
},
"range": Array [
14,
15,
],
"type": "Identifier",
"value": "a",
},
Object {
"loc": Object {
"end": Object {
"column": 9,
"line": 2,
},
"start": Object {
"column": 8,
"line": 2,
},
},
"range": Array [
16,
17,
],
"type": "Punctuator",
"value": "=",
},
Object {
"loc": Object {
"end": Object {
"column": 11,
"line": 2,
},
"start": Object {
"column": 10,
"line": 2,
},
},
"range": Array [
18,
19,
],
"type": "Numeric",
"value": "1",
},
],
"type": "Program",
}
`;

exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = `
Object {
"body": Array [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@deco()
const a = 1
Original file line number Diff line number Diff line change
Expand Up @@ -2299,6 +2299,15 @@ Object {
}
`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-variable.src 1`] = `
Object {
"column": 0,
"index": 0,
"lineNumber": 1,
"message": "Decorators are not valid here.",
}
`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = `
Expand Down
Loading