Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' into jest-each-pretty
  • Loading branch information
mattphillips committed May 31, 2018
commit cbedc61355dea7194c952640bf9a41edaa45a441
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

### Features

* `[jest-each]` Add pretty-format serialising to each titles ([#6357](https://github.com/facebook/jest/pull/6357))
* `[jest-cli]` shouldRunTestSuite watch hook now receives an object with `config`, `testPath` and `duration` ([#6350](https://github.com/facebook/jest/pull/6350))
* `[jest-each]` Support one dimensional array of data ([#6351](https://github.com/facebook/jest/pull/6351))
* `[jest-watch]` create new package `jest-watch` to ease custom watch plugin development ([#6318](https://github.com/facebook/jest/pull/6318))
* `[jest-circus]` Make hooks in empty describe blocks error ([#6320](https://github.com/facebook/jest/pull/6320))
* Add a config/CLI option `errorOnDeprecated` which makes calling deprecated APIs throw hepful error messages.
- `[jest-each]` Add pretty-format serialising to each titles ([#6357](https://github.com/facebook/jest/pull/6357))
- `[jest-cli]` shouldRunTestSuite watch hook now receives an object with `config`, `testPath` and `duration` ([#6350](https://github.com/facebook/jest/pull/6350))
- `[jest-each]` Support one dimensional array of data ([#6351](https://github.com/facebook/jest/pull/6351))
- `[jest-watch]` create new package `jest-watch` to ease custom watch plugin development ([#6318](https://github.com/facebook/jest/pull/6318))
- `[jest-circus]` Make hooks in empty describe blocks error ([#6320](https://github.com/facebook/jest/pull/6320))
- Add a config/CLI option `errorOnDeprecated` which makes calling deprecated APIs throw hepful error messages.

### Fixes

Expand Down
48 changes: 24 additions & 24 deletions docs/GlobalAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,18 @@ Use `describe.each` if you keep duplicating the same test suites with different

#### 1. `describe.each(table)(name, fn)`

* `table`: `Array` of Arrays with the arguments that are passed into the `fn` for each row.
* `name`: `String` the title of the test suite.
* Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
* `%s`- String.
* `%d`- Number.
* `%i` - Integer.
* `%f` - Floating point value.
* `%j` - JSON.
* `%o` - Object.
* `%%` - single percent sign ('%'). This does not consume an argument.
* `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
* `fn`: `Function` the suite of tests to be ran, this is the function that will receive the parameters in each row as function arguments.
- `table`: `Array` of Arrays with the arguments that are passed into the `fn` for each row.
- `name`: `String` the title of the test suite.
- Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
- `%s`- String.
- `%d`- Number.
- `%i` - Integer.
- `%f` - Floating point value.
- `%j` - JSON.
- `%o` - Object.
- `%%` - single percent sign ('%'). This does not consume an argument.
- `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add it as a first option, so it's easily discoverable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thymikee done 😄

- `fn`: `Function` the suite of tests to be ran, this is the function that will receive the parameters in each row as function arguments.

Example:

Expand Down Expand Up @@ -475,18 +475,18 @@ Use `test.each` if you keep duplicating the same test with different data. `test

#### 1. `test.each(table)(name, fn)`

* `table`: `Array` of Arrays with the arguments that are passed into the test `fn` for each row.
* `name`: `String` the title of the test block.
* Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
* `%s`- String.
* `%d`- Number.
* `%i` - Integer.
* `%f` - Floating point value.
* `%j` - JSON.
* `%o` - Object.
* `%%` - single percent sign ('%'). This does not consume an argument.
* `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
* `fn`: `Function` the test to be ran, this is the function that will receive the parameters in each row as function arguments.
- `table`: `Array` of Arrays with the arguments that are passed into the test `fn` for each row.
- `name`: `String` the title of the test block.
- Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
- `%s`- String.
- `%d`- Number.
- `%i` - Integer.
- `%f` - Floating point value.
- `%j` - JSON.
- `%o` - Object.
- `%%` - single percent sign ('%'). This does not consume an argument.
- `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
- `fn`: `Function` the test to be ran, this is the function that will receive the parameters in each row as function arguments.

Example:

Expand Down
87 changes: 43 additions & 44 deletions packages/jest-each/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ jest-each allows you to provide multiple arguments to your `test`/`describe` whi

## Features

* `.test` to runs multiple tests with parameterised data
* Also under the alias: `.it`
* `.test.only` to only run the parameterised tests
* Also under the aliases: `.it.only` or `.fit`
* `.test.skip` to skip the parameterised tests
* Also under the aliases: `.it.skip` or `.xit` or `.xtest`
* `.describe` to runs test suites with parameterised data
* `.describe.only` to only run the parameterised suite of tests
* Also under the aliases: `.fdescribe`
* `.describe.skip` to skip the parameterised suite of tests
* Also under the aliases: `.xdescribe`
* Asynchronous tests with `done`
* Unique test titles with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
* `%s`- String.
* `%d`- Number.
* `%i` - Integer.
* `%f` - Floating point value.
* `%j` - JSON.
* `%o` - Object.
* `%%` - single percent sign ('%'). This does not consume an argument.
* `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
* 🖖 Spock like data tables with [Tagged Template Literals](#tagged-template-literal-of-rows)
- `.test` to runs multiple tests with parameterised data
- Also under the alias: `.it`
- `.test.only` to only run the parameterised tests
- Also under the aliases: `.it.only` or `.fit`
- `.test.skip` to skip the parameterised tests
- Also under the aliases: `.it.skip` or `.xit` or `.xtest`
- `.describe` to runs test suites with parameterised data
- `.describe.only` to only run the parameterised suite of tests
- Also under the aliases: `.fdescribe`
- `.describe.skip` to skip the parameterised suite of tests
- Also under the aliases: `.xdescribe`
- Asynchronous tests with `done`
- Unique test titles with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
- `%s`- String.
- `%d`- Number.
- `%i` - Integer.
- `%f` - Floating point value.
- `%j` - JSON.
- `%o` - Object.
- `%%` - single percent sign ('%'). This does not consume an argument.
- `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
- 🖖 Spock like data tables with [Tagged Template Literals](#tagged-template-literal-of-rows)

---

Expand Down Expand Up @@ -99,17 +99,16 @@ const each = require('jest-each');

##### `.test`:

* name: `String` the title of the `test`.
* Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
* `%s`- String.
* `%d`- Number.
* `%i` - Integer.
* `%f` - Floating point value.
* `%j` - JSON.
* `%o` - Object.
* `%%` - single percent sign ('%'). This does not consume an argument.
* `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
* testFn: `Function` the test logic, this is the function that will receive the parameters of each row as function arguments
- name: `String` the title of the `test`.
- Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
- `%s`- String.
- `%d`- Number.
- `%i` - Integer.
- `%f` - Floating point value.
- `%j` - JSON.
- `%o` - Object.
- `%%` - single percent sign ('%'). This does not consume an argument.
- testFn: `Function` the test logic, this is the function that will receive the parameters of each row as function arguments

#### `each([parameters]).describe(name, suiteFn)`

Expand All @@ -119,17 +118,16 @@ const each = require('jest-each');

##### `.describe`:

* name: `String` the title of the `describe`
* Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
* `%s`- String.
* `%d`- Number.
* `%i` - Integer.
* `%f` - Floating point value.
* `%j` - JSON.
* `%o` - Object.
* `%%` - single percent sign ('%'). This does not consume an argument.
* `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format).
* suiteFn: `Function` the suite of `test`/`it`s to be ran, this is the function that will receive the parameters in each row as function arguments
- name: `String` the title of the `describe`
- Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args):
- `%s`- String.
- `%d`- Number.
- `%i` - Integer.
- `%f` - Floating point value.
- `%j` - JSON.
- `%o` - Object.
- `%%` - single percent sign ('%'). This does not consume an argument.
- suiteFn: `Function` the suite of `test`/`it`s to be ran, this is the function that will receive the parameters in each row as function arguments

### Usage

Expand Down Expand Up @@ -434,3 +432,4 @@ each`
## License

MIT

You are viewing a condensed version of this merge commit. You can view the full changes here.