-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(ast-spec): add fixture test framework and some initial fixtures #3258
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class Foo implements 'thing' {} |
3 changes: 3 additions & 0 deletions
3
...assDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-TSESTree-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier TSESTree - Error 1`] = `"NO ERROR"`; |
3 changes: 3 additions & 0 deletions
3
.../ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token (1:21)]`; |
3 changes: 3 additions & 0 deletions
3
...ssDeclaration/fixtures/_error_/implements-non-identifier/snapshots/3-Alignment-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; |
1 change: 1 addition & 0 deletions
1
packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class Foo; |
3 changes: 3 additions & 0 deletions
3
...src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; |
3 changes: 3 additions & 0 deletions
3
...ec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ no-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:9)]`; |
3 changes: 3 additions & 0 deletions
3
...rc/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ no-body Error Alignment 1`] = `"Both errored"`; |
1 change: 1 addition & 0 deletions
1
...ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/fixture.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class 'Foo' {} |
3 changes: 3 additions & 0 deletions
3
...ion/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: '{' expected.]`; |
3 changes: 3 additions & 0 deletions
3
...ration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: A class name is required. (1:6)]`; |
3 changes: 3 additions & 0 deletions
3
...on/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; |
1 change: 1 addition & 0 deletions
1
packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/fixture.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
abstract class Foo {} |
47 changes: 47 additions & 0 deletions
47
...ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration abstract TSESTree - AST 1`] = ` | ||
Program { | ||
type: "Program", | ||
body: Array [ | ||
ClassDeclaration { | ||
type: "ClassDeclaration", | ||
abstract: true, | ||
body: ClassBody { | ||
type: "ClassBody", | ||
body: Array [], | ||
|
||
range: [19, 21], | ||
loc: { | ||
start: { column: 19, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
id: Identifier { | ||
type: "Identifier", | ||
name: "Foo", | ||
|
||
range: [15, 18], | ||
loc: { | ||
start: { column: 15, line: 1 }, | ||
end: { column: 18, line: 1 }, | ||
}, | ||
}, | ||
superClass: null, | ||
|
||
range: [0, 21], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
|
||
range: [0, 22], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 0, line: 2 }, | ||
}, | ||
} | ||
`; |
56 changes: 56 additions & 0 deletions
56
...-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/2-TSESTree-Tokens.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration abstract TSESTree - Tokens 1`] = ` | ||
Array [ | ||
Identifier { | ||
type: "Identifier", | ||
value: "abstract", | ||
|
||
range: [0, 8], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 8, line: 1 }, | ||
}, | ||
}, | ||
Keyword { | ||
type: "Keyword", | ||
value: "class", | ||
|
||
range: [9, 14], | ||
loc: { | ||
start: { column: 9, line: 1 }, | ||
end: { column: 14, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "Foo", | ||
|
||
range: [15, 18], | ||
loc: { | ||
start: { column: 15, line: 1 }, | ||
end: { column: 18, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "{", | ||
|
||
range: [19, 20], | ||
loc: { | ||
start: { column: 19, line: 1 }, | ||
end: { column: 20, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "}", | ||
|
||
range: [20, 21], | ||
loc: { | ||
start: { column: 20, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
] | ||
`; |
47 changes: 47 additions & 0 deletions
47
...es/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/3-Babel-AST.shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ClassDeclaration abstract Babel - AST 1`] = ` | ||
Program { | ||
type: "Program", | ||
body: Array [ | ||
ClassDeclaration { | ||
type: "ClassDeclaration", | ||
abstract: true, | ||
body: ClassBody { | ||
type: "ClassBody", | ||
body: Array [], | ||
|
||
range: [19, 21], | ||
loc: { | ||
start: { column: 19, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
id: Identifier { | ||
type: "Identifier", | ||
name: "Foo", | ||
|
||
range: [15, 18], | ||
loc: { | ||
start: { column: 15, line: 1 }, | ||
end: { column: 18, line: 1 }, | ||
}, | ||
}, | ||
superClass: null, | ||
|
||
range: [0, 21], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
|
||
range: [0, 22], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 0, line: 2 }, | ||
}, | ||
} | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it would be nice to parallelize all these, store the coverage data as an artifact, and have a dependent job pick up the coverage after... not necessary for this PR, just noting down. 📝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah for sure, once I have finished my Nx refactoring we can opt into the Distributed Task Execution and let Nx Cloud decide how to parallelize and distribute across all available agents, then collect all artifacts