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

feature(jest-each): Enable comments inside .each template literal table #8717

Closed
wants to merge 11 commits into from
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- `[@jest/core, @jest/test-sequencer]` Support async sort in custom `testSequencer` ([#8642](https://github.com/facebook/jest/pull/8642))
- `[jest-runtime, @jest/fake-timers]` Add `jest.advanceTimersToNextTimer` ([#8713](https://github.com/facebook/jest/pull/8713))
- `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756))
- `[jest-each]` Enable comments inside `.each` template literal table ([#8717](https://github.com/facebook/jest/pull/8717))

### Fixes

Expand Down
144 changes: 144 additions & 0 deletions packages/jest-each/src/__tests__/__snapshots__/template.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`jest-each .describe comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .describe comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .describe comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .describe throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .describe throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .describe throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -39,11 +57,29 @@ exports[`jest-each .describe throws error when there are no arguments for given
"
`;

exports[`jest-each .describe.only comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .describe.only comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .describe.only comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .describe.only throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .describe.only throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .describe.only throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -78,11 +114,29 @@ exports[`jest-each .describe.only throws error when there are no arguments for g
"
`;

exports[`jest-each .fdescribe comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .fdescribe comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .fdescribe comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .fdescribe throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .fdescribe throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .fdescribe throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -117,11 +171,29 @@ exports[`jest-each .fdescribe throws error when there are no arguments for given
"
`;

exports[`jest-each .fit comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .fit comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .fit comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .fit throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .fit throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .fit throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -156,11 +228,29 @@ exports[`jest-each .fit throws error when there are no arguments for given headi
"
`;

exports[`jest-each .it comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .it comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .it comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .it throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .it throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .it throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -195,11 +285,29 @@ exports[`jest-each .it throws error when there are no arguments for given headin
"
`;

exports[`jest-each .it.only comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .it.only comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .it.only comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .it.only throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .it.only throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .it.only throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -234,11 +342,29 @@ exports[`jest-each .it.only throws error when there are no arguments for given h
"
`;

exports[`jest-each .test comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .test comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .test comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .test throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .test throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .test throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down Expand Up @@ -273,11 +399,29 @@ exports[`jest-each .test throws error when there are no arguments for given head
"
`;

exports[`jest-each .test.only comments throws error part of data is commented out 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

Received:
<red>Array [</>
<red> 0,</>
<red>]</>

Missing <red>1</> argument"
`;

exports[`jest-each .test.only comments throws syntax error when closing multiline comment was never closed 1`] = `"Unexpected trailing token /*"`;

exports[`jest-each .test.only comments throws syntax error when closing multiline comment was never opened 1`] = `"Unexpected token */"`;

exports[`jest-each .test.only throws an error when called with an empty string 1`] = `
"Error: \`.each\` called with an empty Tagged Template Literal of table data.
"
`;

exports[`jest-each .test.only throws error when headings are missing 1`] = `"Headings are required"`;

exports[`jest-each .test.only throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Not enough arguments supplied for given headings:
<green>a | b | expected</>
Expand Down
Loading