Skip to content

Commit

Permalink
[jest-each] Refactor logic (#6345)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattphillips authored and SimenB committed May 29, 2018
1 parent c13dd2f commit 2307643
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 189 deletions.
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

0 comments on commit 2307643

Please sign in to comment.