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

[jest-each] Refactor logic #6345

Merged
merged 4 commits into from
May 29, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### Chore & Maintenance

* `[jest-each]` Refactor each to use shared implementation with core ([#6345](https://github.com/facebook/jest/pull/6345))
* `[jest-each]` Update jest-each docs for serialising values into titles ([#6337](https://github.com/facebook/jest/pull/6337))
* `[jest-circus]` Add dependency on jest-each ([#6309](https://github.com/facebook/jest/pull/6309))
* `[filenames]` Rename "integration-tests" to "e2e" ([#6315](https://github.com/facebook/jest/pull/6315))
Expand Down
232 changes: 184 additions & 48 deletions packages/jest-each/src/__tests__/__snapshots__/template.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,97 +1,233 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`jest-each .describe throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .describe throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .describe.only throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .describe.only throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .fdescribe throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .fdescribe throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .fit throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .fit throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .it throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .it throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .it.only throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .it.only throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .test throws error when there are fewer arguments than headings over multiple rows 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1,1,1,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

exports[`jest-each .test throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;

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

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

Missing <red>2</> arguments"
`;

exports[`jest-each .test.only throws error when there are fewer arguments than headings when given one row 1`] = `
"Tagged Template Literal test error:
Not enough arguments supplied for given headings: a | b | expected
Received: 0,1"
"Not enough arguments supplied for given headings:
<green>a | b | expected</>

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

Missing <red>2</> arguments"
`;
8 changes: 8 additions & 0 deletions packages/jest-each/src/__tests__/array.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import each from '../';

const noop = () => {};
Expand Down
8 changes: 8 additions & 0 deletions packages/jest-each/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import each from '../';

describe('array', () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/jest-each/src/__tests__/template.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import each from '../';

const noop = () => {};
Expand Down
40 changes: 0 additions & 40 deletions packages/jest-each/src/array.js

This file was deleted.

Loading