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(ast-spec): snapshot codeframe of error #6555

Merged
merged 1 commit into from Mar 2, 2023
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
1 change: 1 addition & 0 deletions packages/ast-spec/package.json
Expand Up @@ -46,6 +46,7 @@
"@babel/core": "*",
"@babel/eslint-parser": "*",
"@babel/parser": "*",
"@babel/code-frame": "*",
"@microsoft/api-extractor": "^7.23.2",
"@types/babel__core": "*",
"glob": "*",
Expand Down
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`;
exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body TSESTree - Error 1`] = `
"TSError
> 1 | class Foo;
| ^ '{' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: '{' expected.]`;
exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `
"TSError
> 1 | class 'Foo' {}
| ^ '{' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`;
exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `
"TSError
> 1 | class C<1> {}
| ^ Type parameter declaration expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source TSESTree - Error 1`] = `[TSError: Expression expected.]`;
exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source TSESTree - Error 1`] = `
"TSError
> 1 | export * from;
| ^ Expression expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `
"TSError
> 1 | export * as 'foo' from 'module';
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source TSESTree - Error 1`] = `[TSError: Module specifier must be a string literal.]`;
exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source TSESTree - Error 1`] = `
"TSError
> 1 | export * from module;
| ^ Module specifier must be a string literal.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum TSESTree - Error 1`] = `[TSError: Expression expected.]`;
exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum TSESTree - Error 1`] = `
"TSError
> 1 | export default enum Foo {}
| ^ Expression expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace TSESTree - Error 1`] = `[TSError: ';' expected.]`;
exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace TSESTree - Error 1`] = `
"TSError
> 1 | export default namespace Foo {}
| ^ ';' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias TSESTree - Error 1`] = `[TSError: ';' expected.]`;
exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias TSESTree - Error 1`] = `
"TSError
> 1 | export default type Foo = 1;
| ^ ';' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration TSESTree - Error 1`] = `[TSError: Expression expected.]`;
exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration TSESTree - Error 1`] = `
"TSError
> 1 | export default const x = 1;
| ^ Expression expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal TSESTree - Error 1`] = `
"TSError
> 1 | export { a as 'a' };
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression TSESTree - Error 1`] = `
"TSError
> 1 | export function () {}
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function TSESTree - Error 1`] = `
"TSError
> 1 | export () => {};
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression TSESTree - Error 1`] = `
"TSError
> 1 | export (class Foo {});
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct TSESTree - Error 1`] = `
"TSError
> 1 | export a;
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced TSESTree - Error 1`] = `
"TSError
> 1 | export { 'a' };
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct TSESTree - Error 1`] = `
"TSError
> 1 | export 'a';
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported TSESTree - Error 1`] = `
"TSError
> 1 | function () {}
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `
"TSError
> 1 | function 1() {}
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`;
exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `
"TSError
> 1 | function foo<1>() {}
| ^ Type parameter declaration expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier TSESTree - Error 1`] = `
"TSError
> 1 | import 1 from 'mod';
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace TSESTree - Error 1`] = `
"TSError
> 1 | import { b }, * as a from 'a';
| ^ 'from' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `
"TSError
> 1 | import { 1 } from 'mod';
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default TSESTree - Error 1`] = `[TSError: 'from' expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default TSESTree - Error 1`] = `
"TSError
> 1 | import * as b, a from 'mod';
| ^ 'from' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named TSESTree - Error 1`] = `[TSError: 'from' expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named TSESTree - Error 1`] = `
"TSError
> 1 | import * as a, { b } from 'a';
| ^ 'from' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace TSESTree - Error 1`] = `
"TSError
> 1 | import * as a, * as b from 'a';
| ^ 'from' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier TSESTree - Error 1`] = `
"TSError
> 1 | import * as 1 from 'mod';
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration ImportDeclaration _error_ non-string-source TSESTree - Error 1`] = `[TSError: Module specifier must be a string literal.]`;
exports[`AST Fixtures declaration ImportDeclaration _error_ non-string-source TSESTree - Error 1`] = `
"TSError
> 1 | import * as x from module;
| ^ Module specifier must be a string literal.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported TSESTree - Error 1`] = `
"TSError
> 1 | declare function ();
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-name TSESTree - Error 1`] = `
"TSError
> 1 | declare function 1();
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`;
exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param TSESTree - Error 1`] = `
"TSError
> 1 | declare function f<1>(): void;
| ^ Type parameter declaration expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`;
exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body TSESTree - Error 1`] = `
"TSError
> 1 | enum Foo;
| ^ '{' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id TSESTree - Error 1`] = `
"TSError
> 1 | enum {}
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSEnumDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration TSEnumDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `
"TSError
> 1 | enum 1 {}
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid TSESTree - Error 1`] = `[TSError: Identifier expected.]`;
exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid TSESTree - Error 1`] = `
"TSError
> 1 | import F = 1;
| ^ Identifier expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`;
exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id TSESTree - Error 1`] = `
"TSError
> 1 | import = A.B;
| ^ Declaration or statement expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference TSESTree - Error 1`] = `[TSError: '=' expected.]`;
exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference TSESTree - Error 1`] = `
"TSError
> 1 | import F;
| ^ '=' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`;
exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body TSESTree - Error 1`] = `
"TSError
> 1 | interface F;
| ^ '{' expected.
2 |"
`;
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Interface must be given a name.]`;
exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id TSESTree - Error 1`] = `
"TSError
> 1 | interface {}
| ^ Interface must be given a name.
2 |"
`;