Skip to content

Commit

Permalink
test(ts-estree): add regression test for decorators on variables (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 authored and JamesHenry committed Feb 2, 2019
1 parent 76600a5 commit 3efb265
Show file tree
Hide file tree
Showing 4 changed files with 498 additions and 0 deletions.
244 changes: 244 additions & 0 deletions packages/parser/tests/lib/__snapshots__/typescript.ts.snap
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
@@ -0,0 +1,2 @@
@deco()
const a = 1
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

0 comments on commit 3efb265

Please sign in to comment.