Skip to content

Commit

Permalink
Merge branch 'master' into coverage-no-tests-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysawilliams2010 authored May 29, 2018
2 parents 6478195 + 2307643 commit 3baf41a
Show file tree
Hide file tree
Showing 577 changed files with 1,037 additions and 576 deletions.
38 changes: 32 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: yarn lint && yarn typecheck && yarn lint-es5-build && yarn lint:md:ci
- run: yarn lint --format junit -o reports/junit/js-lint-results.xml && yarn typecheck && yarn lint-es5-build --format junit -o reports/junit/js-es5-lint-results.xml && yarn lint:md:ci
- store_test_results:
path: reports/junit

test-browser:
working_directory: ~/jest
Expand All @@ -64,7 +66,12 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: yarn test-ci-partial
- run:
command: yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
- store_test_results:
path: reports/junit

test-node-9:
working_directory: ~/jest
Expand All @@ -75,7 +82,11 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: yarn test-ci-partial
- run:
command: yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"


test-jest-circus:
working_directory: ~/jest
Expand All @@ -86,7 +97,12 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: JEST_CIRCUS=1 yarn test-ci-partial
- run:
command: JEST_CIRCUS=1 yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
- store_test_results:
path: reports/junit

test-node-8:
working_directory: ~/jest
Expand All @@ -97,7 +113,12 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: yarn test-ci
- run:
command: yarn test-ci
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
- store_test_results:
path: reports/junit

test-node-6:
working_directory: ~/jest
Expand All @@ -108,7 +129,12 @@ jobs:
- restore-cache: *restore-cache
- run: yarn --no-progress
- save-cache: *save-cache
- run: yarn test-ci-partial
- run:
command: yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
- store_test_results:
path: reports/junit

test-and-deploy-website:
working_directory: ~/jest
Expand Down
13 changes: 5 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
},
},
{
files: ['scripts/**/*', 'integration-tests/**/*'],
files: ['scripts/**/*', 'e2e/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
},
Expand All @@ -56,14 +56,11 @@ module.exports = {
},
},
{
excludedFiles: [
'integration-tests/__tests__/**/*',
'website/versioned_docs/**/*.md',
],
excludedFiles: ['e2e/__tests__/**/*', 'website/versioned_docs/**/*.md'],
files: [
'examples/**/*',
'scripts/**/*',
'integration-tests/*/**/*',
'e2e/*/**/*',
'website/*/**/*',
'eslintImportResolver.js',
],
Expand All @@ -81,7 +78,7 @@ module.exports = {
},
{
files: [
'integration-tests/__tests__/**/*',
'e2e/__tests__/**/*',
'packages/babel-jest/**/*.test.js',
'packages/babel-plugin-jest-hoist/**/*.test.js',
'packages/babel-preset-jest/**/*.test.js',
Expand All @@ -103,7 +100,7 @@ module.exports = {
files: [
'website/**',
'**/__tests__/**',
'integration-tests/**',
'e2e/**',
'**/pretty-format/perf/**',
],
rules: {
Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
*~
/examples/*/node_modules/

/integration-tests/*/node_modules
!/integration-tests/presets/json/node_modules
!/integration-tests/presets/js/node_modules
/integration-tests/transform/*/coverage
/integration-tests/transform/*/node_modules
/e2e/*/node_modules
!/e2e/presets/json/node_modules
!/e2e/presets/js/node_modules
/e2e/transform/*/coverage
/e2e/transform/*/node_modules

/node_modules

Expand All @@ -30,3 +30,4 @@ lerna-debug.log
npm-debug.log
npm-debug.log*
yarn-error.log*
junit.xml
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
## master

### Features

* `[jest-watch]` create new package `jest-watch` to ease custom watch plugin development ([#6318](https://github.com/facebook/jest/pull/6318))

### Fixes

* `[expect]` toMatchObject throws TypeError when a source property is null ([#6313](https://github.com/facebook/jest/pull/6313))
* `[jest-cli]` Normalize slashes in paths in CLI output on Windows ((#6310)[https://github.com/facebook/jest/pull/6310])
* `[jest-cli]` Normalize slashes in paths in CLI output on Windows ([#6310](https://github.com/facebook/jest/pull/6310))
* `[jest-cli]` Improve the message when running coverage while there are no files matching global threshold ([#6334](https://github.com/facebook/jest/pull/6334))

### 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))
* `[docs]` Mention the use of commit hash with `--changedSince` flag ([#6330](https://github.com/facebook/jest/pull/6330))

## 23.0.1

### Chore & Maintenance

* `[jest-jasemine2]` Add dependency on jest-each ([#6308](https://github.com/facebook/jest/pull/#6308))
* `[jest-jasemine2]` Add dependency on jest-each ([#6308](https://github.com/facebook/jest/pull/6308))
* `[jest-each]` Move jest-each into core Jest ([#6278](https://github.com/facebook/jest/pull/6278))
* `[examples]` Update typescript example to using ts-jest ([#6260](https://github.com/facebook/jest/pull/6260))

### Fixes

Expand Down Expand Up @@ -121,7 +134,7 @@
* `[docs]` Add docs on using `jest.mock(...)` ([#5648](https://github.com/facebook/jest/pull/5648))
* `[docs]` Mention Jest Puppeteer Preset ([#5722](https://github.com/facebook/jest/pull/5722))
* `[docs]` Add jest-community section to website ([#5675](https://github.com/facebook/jest/pull/5675))
* `[docs]` Add versioned docs for v22.4 ([##5733](https://github.com/facebook/jest/pull/#5733))
* `[docs]` Add versioned docs for v22.4 ([#5733](https://github.com/facebook/jest/pull/5733))
* `[docs]` Improve Snapshot Testing Guide ([#5812](https://github.com/facebook/jest/issues/5812))
* `[jest-runtime]` [**BREAKING**] Remove `jest.genMockFn` and `jest.genMockFunction` ([#6173](https://github.com/facebook/jest/pull/6173))
* `[jest-message-util]` Avoid adding unnecessary indent to blank lines in stack traces ([#6211](https://github.com/facebook/jest/pull/6211))
Expand Down
32 changes: 24 additions & 8 deletions docs/GlobalAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,22 @@ 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, use `%s` to positionally inject test data into the suite title.
* `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.
* `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:

```js
describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
test(`returns ${expected}`, () => {
expect(a + b).toBe(expected);
Expand Down Expand Up @@ -320,7 +328,7 @@ Use `describe.only.each` if you want to only run specific tests suites of data d

```js
describe.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
test(`returns ${expected}`, () => {
expect(a + b).toBe(expected);
Expand Down Expand Up @@ -388,7 +396,7 @@ Use `describe.skip.each` if you want to stop running a suite of data driven test

```js
describe.skip.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
test(`returns ${expected}`, () => {
expect(a + b).toBe(expected); // will not be ran
Expand Down Expand Up @@ -467,14 +475,22 @@ 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, use `%s` to positionally inject parameter values into the test title.
* `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.
* `fn`: `Function` the test to be ran, this is the function that will receive the parameters in each row as function arguments.

Example:

```js
test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
expect(a + b).toBe(expected);
},
Expand Down Expand Up @@ -538,7 +554,7 @@ Use `test.only.each` if you want to only run specific tests with different test

```js
test.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
expect(a + b).toBe(expected);
},
Expand Down Expand Up @@ -600,7 +616,7 @@ Use `test.skip.each` if you want to stop running a collection of data driven tes

```js
test.skip.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%s, %s)',
'.add(%i, %i)',
(a, b, expected) => {
expect(a + b).toBe(expected); // will not be ran
},
Expand Down
2 changes: 1 addition & 1 deletion docs/SnapshotTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Yes, all snapshot files should be committed alongside the modules they are cover

### Does snapshot testing only work with React components?

[React](TutorialReact.md) and [React Native](TutorialReactNative.md) components are a good use case for snapshot testing. However, snapshots can capture any serializable value and should be used anytime the goal is testing whether the output is correct. The Jest repository contains many examples of testing the output of Jest itself, the output of Jest's assertion library as well as log messages from various parts of the Jest codebase. See an example of [snapshotting CLI output](https://github.com/facebook/jest/blob/master/integration-tests/__tests__/console.test.js) in the Jest repo.
[React](TutorialReact.md) and [React Native](TutorialReactNative.md) components are a good use case for snapshot testing. However, snapshots can capture any serializable value and should be used anytime the goal is testing whether the output is correct. The Jest repository contains many examples of testing the output of Jest itself, the output of Jest's assertion library as well as log messages from various parts of the Jest codebase. See an example of [snapshotting CLI output](https://github.com/facebook/jest/blob/master/e2e/__tests__/console.test.js) in the Jest repo.

### What's the difference between snapshot testing and visual regression testing?

Expand Down
File renamed without changes.
Loading

0 comments on commit 3baf41a

Please sign in to comment.