diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md index 1c2d645e5a57..cc8bd8065798 100644 --- a/.github/ISSUE_TEMPLATE/feature.md +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -22,6 +22,6 @@ Why does this feature belong in the [Jest core platform](https://www.youtube.com Common feature proposals that do not typically make it to core: -* New matchers (see [jest-extended](https://github.com/jest-community/jest-extended)) -* Changes to the default reporter (use custom reporters instead) -* Changes to node/jsdom test environments (use custom environments instead) +- New matchers (see [jest-extended](https://github.com/jest-community/jest-extended)) +- Changes to the default reporter (use custom reporters instead) +- Changes to node/jsdom test environments (use custom environments instead) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index e7562ee67679..d26a24cbf165 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -10,6 +10,6 @@ about: If you have questions, please check our Discord or StackOverflow For questions or help please see: -* [The Jest help page](https://facebook.github.io/jest/en/help.html) -* [Our discord channel in Reactiflux](https://discord.gg/MWRhKCj) -* The [jestjs](https://stackoverflow.com/questions/tagged/jestjs) tag on [StackOverflow](https://stackoverflow.com/questions/ask) +- [The Jest help page](https://facebook.github.io/jest/en/help.html) +- [Our discord channel in Reactiflux](https://discord.gg/MWRhKCj) +- The [jestjs](https://stackoverflow.com/questions/tagged/jestjs) tag on [StackOverflow](https://stackoverflow.com/questions/ask) diff --git a/CHANGELOG.md b/CHANGELOG.md index d31a12b9c823..82331fbae684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,1270 +2,1270 @@ ### Features -* `[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-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 -* `[jest-each]` Stop test title concatenating extra args ([##6346](https://github.com/facebook/jest/pull/#6346)) -* `[expect]` toHaveBeenNthCalledWith/nthCalledWith gives wrong call messages if not matched ([#6340](https://github.com/facebook/jest/pull/6340)) -* `[jest-each]` Make sure invalid arguments to `each` points back to the user's code ([#6347](https://github.com/facebook/jest/pull/6347)) -* `[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]` Fix run beforeAll in excluded suites tests" mode. ([#6234](https://github.com/facebook/jest/pull/6234)) -* `[jest-haste-map`] Compute SHA-1s for non-tracked files when using Node crawler ([#6264](https://github.com/facebook/jest/pull/6264)) +- `[jest-each]` Stop test title concatenating extra args ([##6346](https://github.com/facebook/jest/pull/#6346)) +- `[expect]` toHaveBeenNthCalledWith/nthCalledWith gives wrong call messages if not matched ([#6340](https://github.com/facebook/jest/pull/6340)) +- `[jest-each]` Make sure invalid arguments to `each` points back to the user's code ([#6347](https://github.com/facebook/jest/pull/6347)) +- `[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]` Fix run beforeAll in excluded suites tests" mode. ([#6234](https://github.com/facebook/jest/pull/6234)) +- `[jest-haste-map`] Compute SHA-1s for non-tracked files when using Node crawler ([#6264](https://github.com/facebook/jest/pull/6264)) ### Chore & Maintenance -* `[docs]` Improve documentation of `mockClear`, `mockReset`, and `mockRestore` ([#6227](https://github.com/facebook/jest/pull/6227/files)) -* `[jest-circus]` Add dependency on jest-each ([#6309](https://github.com/facebook/jest/pull/#6309)) -* `[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)) +- `[docs]` Improve documentation of `mockClear`, `mockReset`, and `mockRestore` ([#6227](https://github.com/facebook/jest/pull/6227/files)) +- `[jest-circus]` Add dependency on jest-each ([#6309](https://github.com/facebook/jest/pull/#6309)) +- `[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-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)) +- `[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 -* `[pretty-format]` Serialize inverse asymmetric matchers correctly ([#6272](https://github.com/facebook/jest/pull/6272)) +- `[pretty-format]` Serialize inverse asymmetric matchers correctly ([#6272](https://github.com/facebook/jest/pull/6272)) ## 23.0.0 ### Features -* `[expect]` Expose `getObjectSubset`, `iterableEquality`, and `subsetEquality` ([#6210](https://github.com/facebook/jest/pull/6210)) -* `[jest-snapshot]` Add snapshot property matchers ([#6210](https://github.com/facebook/jest/pull/6210)) -* `[jest-config]` Support jest-preset.js files within Node modules ([#6185](https://github.com/facebook/jest/pull/6185)) -* `[jest-cli]` Add `--detectOpenHandles` flag which enables Jest to potentially track down handles keeping it open after tests are complete. ([#6130](https://github.com/facebook/jest/pull/6130)) -* `[jest-jasmine2]` Add data driven testing based on `jest-each` ([#6102](https://github.com/facebook/jest/pull/6102)) -* `[jest-matcher-utils]` Change "suggest to equal" message to be more advisory ([#6103](https://github.com/facebook/jest/issues/6103)) -* `[jest-message-util]` Don't ignore messages with `vendor` anymore ([#6117](https://github.com/facebook/jest/pull/6117)) -* `[jest-validate]` Get rid of `jest-config` dependency ([#6067](https://github.com/facebook/jest/pull/6067)) -* `[jest-validate]` Adds option to inject `deprecationEntries` ([#6067](https://github.com/facebook/jest/pull/6067)) -* `[jest-snapshot]` [**BREAKING**] Concatenate name of test, optional snapshot name and count ([#6015](https://github.com/facebook/jest/pull/6015)) -* `[jest-runtime]` Allow for transform plugins to skip the definition process method if createTransformer method was defined. ([#5999](https://github.com/facebook/jest/pull/5999)) -* `[expect]` Add stack trace for async errors ([#6008](https://github.com/facebook/jest/pull/6008)) -* `[jest-jasmine2]` Add stack trace for timeouts ([#6008](https://github.com/facebook/jest/pull/6008)) -* `[jest-jasmine2]` Add stack trace for thrown non-`Error`s ([#6008](https://github.com/facebook/jest/pull/6008)) -* `[jest-runtime]` Prevent modules from marking themselves as their own parent ([#5235](https://github.com/facebook/jest/issues/5235)) -* `[jest-mock]` Add support for auto-mocking generator functions ([#5983](https://github.com/facebook/jest/pull/5983)) -* `[expect]` Add support for async matchers  ([#5919](https://github.com/facebook/jest/pull/5919)) -* `[expect]` Suggest toContainEqual ([#5948](https://github.com/facebook/jest/pull/5953)) -* `[jest-config]` Export Jest's default options ([#5948](https://github.com/facebook/jest/pull/5948)) -* `[jest-editor-support]` Move `coverage` to `ProjectWorkspace.collectCoverage` ([#5929](https://github.com/facebook/jest/pull/5929)) -* `[jest-editor-support]` Add `coverage` option to runner ([#5836](https://github.com/facebook/jest/pull/5836)) -* `[jest-haste-map]` Support extracting dynamic `import`s ([#5883](https://github.com/facebook/jest/pull/5883)) -* `[expect]` Improve output format for mismatchedArgs in mock/spy calls. ([#5846](https://github.com/facebook/jest/pull/5846)) -* `[jest-cli]` Add support for using `--coverage` in combination with watch mode, `--onlyChanged`, `--findRelatedTests` and more ([#5601](https://github.com/facebook/jest/pull/5601)) -* `[jest-jasmine2]` [**BREAKING**] Adds error throwing and descriptive errors to `it`/ `test` for invalid arguments. `[jest-circus]` Adds error throwing and descriptive errors to `it`/ `test` for invalid arguments ([#5558](https://github.com/facebook/jest/pull/5558)) -* `[jest-matcher-utils]` Add `isNot` option to `matcherHint` function ([#5512](https://github.com/facebook/jest/pull/5512)) -* `[jest-config]` Add `` to runtime files not found error report ([#5693](https://github.com/facebook/jest/pull/5693)) -* `[expect]` Make toThrow matcher pass only if Error object is returned from promises ([#5670](https://github.com/facebook/jest/pull/5670)) -* `[expect]` Add isError to utils ([#5670](https://github.com/facebook/jest/pull/5670)) -* `[expect]` Add inverse matchers (`expect.not.arrayContaining`, etc., [#5517](https://github.com/facebook/jest/pull/5517)) -* `[expect]` `expect.extend` now also extends asymmetric matchers ([#5503](https://github.com/facebook/jest/pull/5503)) -* `[jest-mock]` Update `spyOnProperty` to support spying on the prototype chain ([#5753](https://github.com/facebook/jest/pull/5753)) -* `[jest-mock]` Add tracking of return values in the `mock` property ([#5752](https://github.com/facebook/jest/pull/5752)) -* `[jest-mock]` Add tracking of thrown errors in the `mock` property ([#5764](https://github.com/facebook/jest/pull/5764)) -* `[expect]`Add nthCalledWith spy matcher ([#5605](https://github.com/facebook/jest/pull/5605)) -* `[jest-cli]` Add `isSerial` property that runners can expose to specify that they can not run in parallel ([#5706](https://github.com/facebook/jest/pull/5706)) -* `[expect]` Add `.toBeCalledTimes` and `toHaveBeenNthCalledWith` aliases ([#5826](https://github.com/facebook/jest/pull/5826)) -* `[jest-cli]` Interactive Snapshot Mode improvements ([#5864](https://github.com/facebook/jest/pull/5864)) -* `[jest-editor-support]` Add `no-color` option to runner ([#5909](https://github.com/facebook/jest/pull/5909)) -* `[jest-jasmine2]` Pretty-print non-Error object errors ([#5980](https://github.com/facebook/jest/pull/5980)) -* `[jest-message-util]` Include column in stack frames ([#5889](https://github.com/facebook/jest/pull/5889)) -* `[expect]` Introduce toStrictEqual ([#6032](https://github.com/facebook/jest/pull/6032)) -* `[expect]` Add return matchers ([#5879](https://github.com/facebook/jest/pull/5879)) -* `[jest-cli]` Improve snapshot summaries ([#6181](https://github.com/facebook/jest/pull/6181)) -* `[expect]` Include custom mock names in error messages ([#6199](https://github.com/facebook/jest/pull/6199)) -* `[jest-diff]` Support returning diff from oneline strings ([#6221](https://github.com/facebook/jest/pull/6221)) -* `[expect]` Improve return matchers ([#6172](https://github.com/facebook/jest/pull/6172)) -* `[jest-cli]` Overhaul watch plugin hooks names ([#6249](https://github.com/facebook/jest/pull/6249)) -* `[jest-mock]` Include tracked call results in serialized mock ([#6244](https://github.com/facebook/jest/pull/6244)) +- `[expect]` Expose `getObjectSubset`, `iterableEquality`, and `subsetEquality` ([#6210](https://github.com/facebook/jest/pull/6210)) +- `[jest-snapshot]` Add snapshot property matchers ([#6210](https://github.com/facebook/jest/pull/6210)) +- `[jest-config]` Support jest-preset.js files within Node modules ([#6185](https://github.com/facebook/jest/pull/6185)) +- `[jest-cli]` Add `--detectOpenHandles` flag which enables Jest to potentially track down handles keeping it open after tests are complete. ([#6130](https://github.com/facebook/jest/pull/6130)) +- `[jest-jasmine2]` Add data driven testing based on `jest-each` ([#6102](https://github.com/facebook/jest/pull/6102)) +- `[jest-matcher-utils]` Change "suggest to equal" message to be more advisory ([#6103](https://github.com/facebook/jest/issues/6103)) +- `[jest-message-util]` Don't ignore messages with `vendor` anymore ([#6117](https://github.com/facebook/jest/pull/6117)) +- `[jest-validate]` Get rid of `jest-config` dependency ([#6067](https://github.com/facebook/jest/pull/6067)) +- `[jest-validate]` Adds option to inject `deprecationEntries` ([#6067](https://github.com/facebook/jest/pull/6067)) +- `[jest-snapshot]` [**BREAKING**] Concatenate name of test, optional snapshot name and count ([#6015](https://github.com/facebook/jest/pull/6015)) +- `[jest-runtime]` Allow for transform plugins to skip the definition process method if createTransformer method was defined. ([#5999](https://github.com/facebook/jest/pull/5999)) +- `[expect]` Add stack trace for async errors ([#6008](https://github.com/facebook/jest/pull/6008)) +- `[jest-jasmine2]` Add stack trace for timeouts ([#6008](https://github.com/facebook/jest/pull/6008)) +- `[jest-jasmine2]` Add stack trace for thrown non-`Error`s ([#6008](https://github.com/facebook/jest/pull/6008)) +- `[jest-runtime]` Prevent modules from marking themselves as their own parent ([#5235](https://github.com/facebook/jest/issues/5235)) +- `[jest-mock]` Add support for auto-mocking generator functions ([#5983](https://github.com/facebook/jest/pull/5983)) +- `[expect]` Add support for async matchers  ([#5919](https://github.com/facebook/jest/pull/5919)) +- `[expect]` Suggest toContainEqual ([#5948](https://github.com/facebook/jest/pull/5953)) +- `[jest-config]` Export Jest's default options ([#5948](https://github.com/facebook/jest/pull/5948)) +- `[jest-editor-support]` Move `coverage` to `ProjectWorkspace.collectCoverage` ([#5929](https://github.com/facebook/jest/pull/5929)) +- `[jest-editor-support]` Add `coverage` option to runner ([#5836](https://github.com/facebook/jest/pull/5836)) +- `[jest-haste-map]` Support extracting dynamic `import`s ([#5883](https://github.com/facebook/jest/pull/5883)) +- `[expect]` Improve output format for mismatchedArgs in mock/spy calls. ([#5846](https://github.com/facebook/jest/pull/5846)) +- `[jest-cli]` Add support for using `--coverage` in combination with watch mode, `--onlyChanged`, `--findRelatedTests` and more ([#5601](https://github.com/facebook/jest/pull/5601)) +- `[jest-jasmine2]` [**BREAKING**] Adds error throwing and descriptive errors to `it`/ `test` for invalid arguments. `[jest-circus]` Adds error throwing and descriptive errors to `it`/ `test` for invalid arguments ([#5558](https://github.com/facebook/jest/pull/5558)) +- `[jest-matcher-utils]` Add `isNot` option to `matcherHint` function ([#5512](https://github.com/facebook/jest/pull/5512)) +- `[jest-config]` Add `` to runtime files not found error report ([#5693](https://github.com/facebook/jest/pull/5693)) +- `[expect]` Make toThrow matcher pass only if Error object is returned from promises ([#5670](https://github.com/facebook/jest/pull/5670)) +- `[expect]` Add isError to utils ([#5670](https://github.com/facebook/jest/pull/5670)) +- `[expect]` Add inverse matchers (`expect.not.arrayContaining`, etc., [#5517](https://github.com/facebook/jest/pull/5517)) +- `[expect]` `expect.extend` now also extends asymmetric matchers ([#5503](https://github.com/facebook/jest/pull/5503)) +- `[jest-mock]` Update `spyOnProperty` to support spying on the prototype chain ([#5753](https://github.com/facebook/jest/pull/5753)) +- `[jest-mock]` Add tracking of return values in the `mock` property ([#5752](https://github.com/facebook/jest/pull/5752)) +- `[jest-mock]` Add tracking of thrown errors in the `mock` property ([#5764](https://github.com/facebook/jest/pull/5764)) +- `[expect]`Add nthCalledWith spy matcher ([#5605](https://github.com/facebook/jest/pull/5605)) +- `[jest-cli]` Add `isSerial` property that runners can expose to specify that they can not run in parallel ([#5706](https://github.com/facebook/jest/pull/5706)) +- `[expect]` Add `.toBeCalledTimes` and `toHaveBeenNthCalledWith` aliases ([#5826](https://github.com/facebook/jest/pull/5826)) +- `[jest-cli]` Interactive Snapshot Mode improvements ([#5864](https://github.com/facebook/jest/pull/5864)) +- `[jest-editor-support]` Add `no-color` option to runner ([#5909](https://github.com/facebook/jest/pull/5909)) +- `[jest-jasmine2]` Pretty-print non-Error object errors ([#5980](https://github.com/facebook/jest/pull/5980)) +- `[jest-message-util]` Include column in stack frames ([#5889](https://github.com/facebook/jest/pull/5889)) +- `[expect]` Introduce toStrictEqual ([#6032](https://github.com/facebook/jest/pull/6032)) +- `[expect]` Add return matchers ([#5879](https://github.com/facebook/jest/pull/5879)) +- `[jest-cli]` Improve snapshot summaries ([#6181](https://github.com/facebook/jest/pull/6181)) +- `[expect]` Include custom mock names in error messages ([#6199](https://github.com/facebook/jest/pull/6199)) +- `[jest-diff]` Support returning diff from oneline strings ([#6221](https://github.com/facebook/jest/pull/6221)) +- `[expect]` Improve return matchers ([#6172](https://github.com/facebook/jest/pull/6172)) +- `[jest-cli]` Overhaul watch plugin hooks names ([#6249](https://github.com/facebook/jest/pull/6249)) +- `[jest-mock]` Include tracked call results in serialized mock ([#6244](https://github.com/facebook/jest/pull/6244)) ### Fixes -* `[jest-cli]` Fix stdin encoding to utf8 for watch plugins. ([#6253](https://github.com/facebook/jest/issues/6253)) -* `[expect]` Better detection of DOM Nodes for equality ([#6246](https://github.com/facebook/jest/pull/6246)) -* `[jest-cli]` Fix misleading action description for F key when in "only failed tests" mode. ([#6167](https://github.com/facebook/jest/issues/6167)) -* `[jest-worker]` Stick calls to workers before processing them ([#6073](https://github.com/facebook/jest/pull/6073)) -* `[babel-plugin-jest-hoist]` Allow using `console` global variable ([#6075](https://github.com/facebook/jest/pull/6075)) -* `[jest-jasmine2]` Always remove node core message from assert stack traces ([#6055](https://github.com/facebook/jest/pull/6055)) -* `[expect]` Add stack trace when `expect.assertions` and `expect.hasAssertions` causes test failures. ([#5997](https://github.com/facebook/jest/pull/5997)) -* `[jest-runtime]` Throw a more useful error when trying to require modules after the test environment is torn down ([#5888](https://github.com/facebook/jest/pull/5888)) -* `[jest-mock]` [**BREAKING**] Replace timestamps with `invocationCallOrder` ([#5867](https://github.com/facebook/jest/pull/5867)) -* `[jest-jasmine2]` Install `sourcemap-support` into normal runtime to catch runtime errors ([#5945](https://github.com/facebook/jest/pull/5945)) -* `[jest-jasmine2]` Added assertion error handling inside `afterAll hook` ([#5884](https://github.com/facebook/jest/pull/5884)) -* `[jest-cli]` Remove the notifier actions in case of failure when not in watch mode. ([#5861](https://github.com/facebook/jest/pull/5861)) -* `[jest-mock]` Extend .toHaveBeenCalled return message with outcome ([#5951](https://github.com/facebook/jest/pull/5951)) -* `[jest-runner]` Assign `process.env.JEST_WORKER_ID="1"` when in runInBand mode ([#5860](https://github.com/facebook/jest/pull/5860)) -* `[jest-cli]` Add descriptive error message when trying to use `globalSetup`/`globalTeardown` file that doesn't export a function. ([#5835](https://github.com/facebook/jest/pull/5835)) -* `[expect]` Do not rely on `instanceof RegExp`, since it will not work for RegExps created inside of a different VM ([#5729](https://github.com/facebook/jest/pull/5729)) -* `[jest-resolve]` Update node module resolution algorithm to correctly handle symlinked paths ([#5085](https://github.com/facebook/jest/pull/5085)) -* `[jest-editor-support]` Update `Settings` to use spawn in shell option ([#5658](https://github.com/facebook/jest/pull/5658)) -* `[jest-cli]` Improve the error message when 2 projects resolve to the same config ([#5674](https://github.com/facebook/jest/pull/5674)) -* `[jest-runtime]` remove retainLines from coverage instrumentation ([#5692](https://github.com/facebook/jest/pull/5692)) -* `[jest-cli]` Fix update snapshot issue when using watchAll ([#5696](https://github.com/facebook/jest/pull/5696)) -* `[expect]` Fix rejects.not matcher ([#5670](https://github.com/facebook/jest/pull/5670)) -* `[jest-runtime]` Prevent Babel warnings on large files ([#5702](https://github.com/facebook/jest/pull/5702)) -* `[jest-mock]` Prevent `mockRejectedValue` from causing unhandled rejection ([#5720](https://github.com/facebook/jest/pull/5720)) -* `[pretty-format]` Handle React fragments better ([#5816](https://github.com/facebook/jest/pull/5816)) -* `[pretty-format]` Handle formatting of `React.forwardRef` and `Context` components ([#6093](https://github.com/facebook/jest/pull/6093)) -* `[jest-cli]` Switch collectCoverageFrom back to a string ([#5914](https://github.com/facebook/jest/pull/5914)) -* `[jest-regex-util]` Fix handling regex symbols in tests path on Windows ([#5941](https://github.com/facebook/jest/pull/5941)) -* `[jest-util]` Fix handling of NaN/Infinity in mock timer delay ([#5966](https://github.com/facebook/jest/pull/5966)) -* `[jest-resolve]` Generalise test for package main entries equivalent to ".". ([#5968](https://github.com/facebook/jest/pull/5968)) -* `[jest-config]` Ensure that custom resolvers are used when resolving the configuration ([#5976](https://github.com/facebook/jest/pull/5976)) -* `[website]` Fix website docs ([#5853](https://github.com/facebook/jest/pull/5853)) -* `[expect]` Fix isEqual Set and Map to compare object values and keys regardless of order ([#6150](https://github.com/facebook/jest/pull/6150)) -* `[pretty-format]` [**BREAKING**] Remove undefined props from React elements ([#6162](https://github.com/facebook/jest/pull/6162)) -* `[jest-haste-map]` Properly resolve mocked node modules without package.json defined ([#6232](https://github.com/facebook/jest/pull/6232)) +- `[jest-cli]` Fix stdin encoding to utf8 for watch plugins. ([#6253](https://github.com/facebook/jest/issues/6253)) +- `[expect]` Better detection of DOM Nodes for equality ([#6246](https://github.com/facebook/jest/pull/6246)) +- `[jest-cli]` Fix misleading action description for F key when in "only failed tests" mode. ([#6167](https://github.com/facebook/jest/issues/6167)) +- `[jest-worker]` Stick calls to workers before processing them ([#6073](https://github.com/facebook/jest/pull/6073)) +- `[babel-plugin-jest-hoist]` Allow using `console` global variable ([#6075](https://github.com/facebook/jest/pull/6075)) +- `[jest-jasmine2]` Always remove node core message from assert stack traces ([#6055](https://github.com/facebook/jest/pull/6055)) +- `[expect]` Add stack trace when `expect.assertions` and `expect.hasAssertions` causes test failures. ([#5997](https://github.com/facebook/jest/pull/5997)) +- `[jest-runtime]` Throw a more useful error when trying to require modules after the test environment is torn down ([#5888](https://github.com/facebook/jest/pull/5888)) +- `[jest-mock]` [**BREAKING**] Replace timestamps with `invocationCallOrder` ([#5867](https://github.com/facebook/jest/pull/5867)) +- `[jest-jasmine2]` Install `sourcemap-support` into normal runtime to catch runtime errors ([#5945](https://github.com/facebook/jest/pull/5945)) +- `[jest-jasmine2]` Added assertion error handling inside `afterAll hook` ([#5884](https://github.com/facebook/jest/pull/5884)) +- `[jest-cli]` Remove the notifier actions in case of failure when not in watch mode. ([#5861](https://github.com/facebook/jest/pull/5861)) +- `[jest-mock]` Extend .toHaveBeenCalled return message with outcome ([#5951](https://github.com/facebook/jest/pull/5951)) +- `[jest-runner]` Assign `process.env.JEST_WORKER_ID="1"` when in runInBand mode ([#5860](https://github.com/facebook/jest/pull/5860)) +- `[jest-cli]` Add descriptive error message when trying to use `globalSetup`/`globalTeardown` file that doesn't export a function. ([#5835](https://github.com/facebook/jest/pull/5835)) +- `[expect]` Do not rely on `instanceof RegExp`, since it will not work for RegExps created inside of a different VM ([#5729](https://github.com/facebook/jest/pull/5729)) +- `[jest-resolve]` Update node module resolution algorithm to correctly handle symlinked paths ([#5085](https://github.com/facebook/jest/pull/5085)) +- `[jest-editor-support]` Update `Settings` to use spawn in shell option ([#5658](https://github.com/facebook/jest/pull/5658)) +- `[jest-cli]` Improve the error message when 2 projects resolve to the same config ([#5674](https://github.com/facebook/jest/pull/5674)) +- `[jest-runtime]` remove retainLines from coverage instrumentation ([#5692](https://github.com/facebook/jest/pull/5692)) +- `[jest-cli]` Fix update snapshot issue when using watchAll ([#5696](https://github.com/facebook/jest/pull/5696)) +- `[expect]` Fix rejects.not matcher ([#5670](https://github.com/facebook/jest/pull/5670)) +- `[jest-runtime]` Prevent Babel warnings on large files ([#5702](https://github.com/facebook/jest/pull/5702)) +- `[jest-mock]` Prevent `mockRejectedValue` from causing unhandled rejection ([#5720](https://github.com/facebook/jest/pull/5720)) +- `[pretty-format]` Handle React fragments better ([#5816](https://github.com/facebook/jest/pull/5816)) +- `[pretty-format]` Handle formatting of `React.forwardRef` and `Context` components ([#6093](https://github.com/facebook/jest/pull/6093)) +- `[jest-cli]` Switch collectCoverageFrom back to a string ([#5914](https://github.com/facebook/jest/pull/5914)) +- `[jest-regex-util]` Fix handling regex symbols in tests path on Windows ([#5941](https://github.com/facebook/jest/pull/5941)) +- `[jest-util]` Fix handling of NaN/Infinity in mock timer delay ([#5966](https://github.com/facebook/jest/pull/5966)) +- `[jest-resolve]` Generalise test for package main entries equivalent to ".". ([#5968](https://github.com/facebook/jest/pull/5968)) +- `[jest-config]` Ensure that custom resolvers are used when resolving the configuration ([#5976](https://github.com/facebook/jest/pull/5976)) +- `[website]` Fix website docs ([#5853](https://github.com/facebook/jest/pull/5853)) +- `[expect]` Fix isEqual Set and Map to compare object values and keys regardless of order ([#6150](https://github.com/facebook/jest/pull/6150)) +- `[pretty-format]` [**BREAKING**] Remove undefined props from React elements ([#6162](https://github.com/facebook/jest/pull/6162)) +- `[jest-haste-map]` Properly resolve mocked node modules without package.json defined ([#6232](https://github.com/facebook/jest/pull/6232)) ### Chore & Maintenance -* `[jest-runner]` Move sourcemap installation from `jest-jasmine2` to `jest-runner` ([#6176](https://github.com/facebook/jest/pull/6176)) -* `[jest-cli]` Use yargs's built-in `version` instead of rolling our own ([#6215](https://github.com/facebook/jest/pull/6215)) -* `[docs]` Add explanation on how to mock methods not implemented in JSDOM -* `[jest-jasmine2]` Simplify `Env.execute` and TreeProcessor to setup and clean resources for the top suite the same way as for all of the children suites ([#5885](https://github.com/facebook/jest/pull/5885)) -* `[babel-jest]` [**BREAKING**] Always return object from transformer ([#5991](https://github.com/facebook/jest/pull/5991)) -* `[*]` Run Prettier on compiled output ([#5858](https://github.com/facebook/jest/pull/3497)) -* `[jest-cli]` Add fileChange hook for plugins ([#5708](https://github.com/facebook/jest/pull/5708)) -* `[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]` 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)) +- `[jest-runner]` Move sourcemap installation from `jest-jasmine2` to `jest-runner` ([#6176](https://github.com/facebook/jest/pull/6176)) +- `[jest-cli]` Use yargs's built-in `version` instead of rolling our own ([#6215](https://github.com/facebook/jest/pull/6215)) +- `[docs]` Add explanation on how to mock methods not implemented in JSDOM +- `[jest-jasmine2]` Simplify `Env.execute` and TreeProcessor to setup and clean resources for the top suite the same way as for all of the children suites ([#5885](https://github.com/facebook/jest/pull/5885)) +- `[babel-jest]` [**BREAKING**] Always return object from transformer ([#5991](https://github.com/facebook/jest/pull/5991)) +- `[*]` Run Prettier on compiled output ([#5858](https://github.com/facebook/jest/pull/3497)) +- `[jest-cli]` Add fileChange hook for plugins ([#5708](https://github.com/facebook/jest/pull/5708)) +- `[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]` 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)) ## 22.4.2 ### Fixes -* `[jest-haste-map]` Recreate Haste map when deserialization fails ([#5642](https://github.com/facebook/jest/pull/5642)) +- `[jest-haste-map]` Recreate Haste map when deserialization fails ([#5642](https://github.com/facebook/jest/pull/5642)) ## 22.4.1 ### Fixes -* `[jest-haste-map]` Parallelize Watchman calls in crawler ([#5640](https://github.com/facebook/jest/pull/5640)) -* `[jest-editor-support]` Update TypeScript definitions ([#5625](https://github.com/facebook/jest/pull/5625)) -* `[babel-jest]` Remove `retainLines` argument to babel. ([#5594](https://github.com/facebook/jest/pull/5594)) +- `[jest-haste-map]` Parallelize Watchman calls in crawler ([#5640](https://github.com/facebook/jest/pull/5640)) +- `[jest-editor-support]` Update TypeScript definitions ([#5625](https://github.com/facebook/jest/pull/5625)) +- `[babel-jest]` Remove `retainLines` argument to babel. ([#5594](https://github.com/facebook/jest/pull/5594)) ### Features -* `[jest-runtime]` Provide `require.main` property set to module with test suite ([#5618](https://github.com/facebook/jest/pull/5618)) +- `[jest-runtime]` Provide `require.main` property set to module with test suite ([#5618](https://github.com/facebook/jest/pull/5618)) ### Chore & Maintenance -* `[docs]` Add note about Node version support ([#5622](https://github.com/facebook/jest/pull/5622)) -* `[docs]` Update to use yarn ([#5624](https://github.com/facebook/jest/pull/5624)) -* `[docs]` Add how to mock scoped modules to Manual Mocks doc ([#5638](https://github.com/facebook/jest/pull/5638)) +- `[docs]` Add note about Node version support ([#5622](https://github.com/facebook/jest/pull/5622)) +- `[docs]` Update to use yarn ([#5624](https://github.com/facebook/jest/pull/5624)) +- `[docs]` Add how to mock scoped modules to Manual Mocks doc ([#5638](https://github.com/facebook/jest/pull/5638)) ## 22.4.0 ### Fixes -* `[jest-haste-map]` Overhauls how Watchman crawler works fixing Windows ([#5615](https://github.com/facebook/jest/pull/5615)) -* `[expect]` Allow matching of Errors against plain objects ([#5611](https://github.com/facebook/jest/pull/5611)) -* `[jest-haste-map]` Do not read binary files in Haste, even when instructed to do so ([#5612](https://github.com/facebook/jest/pull/5612)) -* `[jest-cli]` Don't skip matchers for exact files ([#5582](https://github.com/facebook/jest/pull/5582)) -* `[docs]` Update discord links ([#5586](https://github.com/facebook/jest/pull/5586)) -* `[jest-runtime]` Align handling of testRegex on Windows between searching for tests and instrumentation checks ([#5560](https://github.com/facebook/jest/pull/5560)) -* `[jest-config]` Make it possible to merge `transform` option with preset ([#5505](https://github.com/facebook/jest/pull/5505)) -* `[jest-util]` Fix `console.assert` behavior in custom & buffered consoles ([#5576](https://github.com/facebook/jest/pull/5576)) +- `[jest-haste-map]` Overhauls how Watchman crawler works fixing Windows ([#5615](https://github.com/facebook/jest/pull/5615)) +- `[expect]` Allow matching of Errors against plain objects ([#5611](https://github.com/facebook/jest/pull/5611)) +- `[jest-haste-map]` Do not read binary files in Haste, even when instructed to do so ([#5612](https://github.com/facebook/jest/pull/5612)) +- `[jest-cli]` Don't skip matchers for exact files ([#5582](https://github.com/facebook/jest/pull/5582)) +- `[docs]` Update discord links ([#5586](https://github.com/facebook/jest/pull/5586)) +- `[jest-runtime]` Align handling of testRegex on Windows between searching for tests and instrumentation checks ([#5560](https://github.com/facebook/jest/pull/5560)) +- `[jest-config]` Make it possible to merge `transform` option with preset ([#5505](https://github.com/facebook/jest/pull/5505)) +- `[jest-util]` Fix `console.assert` behavior in custom & buffered consoles ([#5576](https://github.com/facebook/jest/pull/5576)) ### Features -* `[docs]` Add MongoDB guide ([#5571](https://github.com/facebook/jest/pull/5571)) -* `[jest-runtime]` Deprecate mapCoverage option. ([#5177](https://github.com/facebook/jest/pull/5177)) -* `[babel-jest]` Add option to return sourcemap from the transformer separately from source. ([#5177](https://github.com/facebook/jest/pull/5177)) -* `[jest-validate]` Add ability to log deprecation warnings for CLI flags. ([#5536](https://github.com/facebook/jest/pull/5536)) -* `[jest-serializer]` Added new module for serializing. Works using V8 or JSON ([#5609](https://github.com/facebook/jest/pull/5609)) -* `[docs]` Add a documentation note for project `displayName` configuration ([#5600](https://github.com/facebook/jest/pull/5600)) +- `[docs]` Add MongoDB guide ([#5571](https://github.com/facebook/jest/pull/5571)) +- `[jest-runtime]` Deprecate mapCoverage option. ([#5177](https://github.com/facebook/jest/pull/5177)) +- `[babel-jest]` Add option to return sourcemap from the transformer separately from source. ([#5177](https://github.com/facebook/jest/pull/5177)) +- `[jest-validate]` Add ability to log deprecation warnings for CLI flags. ([#5536](https://github.com/facebook/jest/pull/5536)) +- `[jest-serializer]` Added new module for serializing. Works using V8 or JSON ([#5609](https://github.com/facebook/jest/pull/5609)) +- `[docs]` Add a documentation note for project `displayName` configuration ([#5600](https://github.com/facebook/jest/pull/5600)) ### Chore & Maintenance -* `[docs]` Update automatic mocks documentation ([#5630](https://github.com/facebook/jest/pull/5630)) +- `[docs]` Update automatic mocks documentation ([#5630](https://github.com/facebook/jest/pull/5630)) ## jest 22.3.0 ### Fixes -* `[expect]` Add descriptive error message to CalledWith methods when missing optional arguments ([#5547](https://github.com/facebook/jest/pull/5547)) -* `[jest-cli]` Fix inability to quit watch mode while debugger is still attached ([#5029](https://github.com/facebook/jest/pull/5029)) -* `[jest-haste-map]` Properly handle platform-specific file deletions ([#5534](https://github.com/facebook/jest/pull/5534)) +- `[expect]` Add descriptive error message to CalledWith methods when missing optional arguments ([#5547](https://github.com/facebook/jest/pull/5547)) +- `[jest-cli]` Fix inability to quit watch mode while debugger is still attached ([#5029](https://github.com/facebook/jest/pull/5029)) +- `[jest-haste-map]` Properly handle platform-specific file deletions ([#5534](https://github.com/facebook/jest/pull/5534)) ### Features -* `[jest-util]` Add the following methods to the "console" implementations: `assert`, `count`, `countReset`, `dir`, `dirxml`, `group`, `groupCollapsed`, `groupEnd`, `time`, `timeEnd` ([#5514](https://github.com/facebook/jest/pull/5514)) -* `[docs]` Add documentation for interactive snapshot mode ([#5291](https://github.com/facebook/jest/pull/5291)) -* `[jest-editor-support]` Add watchAll flag ([#5523](https://github.com/facebook/jest/pull/5523)) -* `[jest-cli]` Support multiple glob patterns for `collectCoverageFrom` ([#5537](https://github.com/facebook/jest/pull/5537)) -* `[docs]` Add versioned documentation to the website ([#5541](https://github.com/facebook/jest/pull/5541)) +- `[jest-util]` Add the following methods to the "console" implementations: `assert`, `count`, `countReset`, `dir`, `dirxml`, `group`, `groupCollapsed`, `groupEnd`, `time`, `timeEnd` ([#5514](https://github.com/facebook/jest/pull/5514)) +- `[docs]` Add documentation for interactive snapshot mode ([#5291](https://github.com/facebook/jest/pull/5291)) +- `[jest-editor-support]` Add watchAll flag ([#5523](https://github.com/facebook/jest/pull/5523)) +- `[jest-cli]` Support multiple glob patterns for `collectCoverageFrom` ([#5537](https://github.com/facebook/jest/pull/5537)) +- `[docs]` Add versioned documentation to the website ([#5541](https://github.com/facebook/jest/pull/5541)) ### Chore & Maintenance -* `[jest-config]` Allow `` to be used with `collectCoverageFrom` ([#5524](https://github.com/facebook/jest/pull/5524)) -* `[filenames]` Standardize files names in "integration-tests" folder ([#5513](https://github.com/facebook/jest/pull/5513)) +- `[jest-config]` Allow `` to be used with `collectCoverageFrom` ([#5524](https://github.com/facebook/jest/pull/5524)) +- `[filenames]` Standardize files names in "integration-tests" folder ([#5513](https://github.com/facebook/jest/pull/5513)) ## jest 22.2.2 ### Fixes -* `[babel-jest]` Revert "Remove retainLines from babel-jest" ([#5496](https://github.com/facebook/jest/pull/5496)) -* `[jest-docblock]` Support multiple of the same `@pragma`. ([#5154](https://github.com/facebook/jest/pull/5502)) +- `[babel-jest]` Revert "Remove retainLines from babel-jest" ([#5496](https://github.com/facebook/jest/pull/5496)) +- `[jest-docblock]` Support multiple of the same `@pragma`. ([#5154](https://github.com/facebook/jest/pull/5502)) ### Features -* `[jest-worker]` Assign a unique id for each worker and pass it to the child process. It will be available via `process.env.JEST_WORKER_ID` ([#5494](https://github.com/facebook/jest/pull/5494)) +- `[jest-worker]` Assign a unique id for each worker and pass it to the child process. It will be available via `process.env.JEST_WORKER_ID` ([#5494](https://github.com/facebook/jest/pull/5494)) ### Chore & Maintenance -* `[filenames]` Standardize file names in root ([#5500](https://github.com/facebook/jest/pull/5500)) +- `[filenames]` Standardize file names in root ([#5500](https://github.com/facebook/jest/pull/5500)) ## jest 22.2.1 ### Fixes -* `[jest-config]` "all" takes precedence over "lastCommit" ([#5486](https://github.com/facebook/jest/pull/5486)) +- `[jest-config]` "all" takes precedence over "lastCommit" ([#5486](https://github.com/facebook/jest/pull/5486)) ## jest 22.2.0 ### Features -* `[jest-runner]` Move test summary to after coverage report ([#4512](https://github.com/facebook/jest/pull/4512)) -* `[jest-cli]` Added `--notifyMode` to specify when to be notified. ([#5125](https://github.com/facebook/jest/pull/5125)) -* `[diff-sequences]` New package compares items in two sequences to find a **longest common subsequence**. ([#5407](https://github.com/facebook/jest/pull/5407)) -* `[jest-matcher-utils]` Add `comment` option to `matcherHint` function ([#5437](https://github.com/facebook/jest/pull/5437)) -* `[jest-config]` Allow lastComit and changedFilesWithAncestor via JSON config ([#5476](https://github.com/facebook/jest/pull/5476)) -* `[jest-util]` Add deletion to `process.env` as well ([#5466](https://github.com/facebook/jest/pull/5466)) -* `[jest-util]` Add case-insensitive getters/setters to `process.env` ([#5465](https://github.com/facebook/jest/pull/5465)) -* `[jest-mock]` Add util methods to create async functions. ([#5318](https://github.com/facebook/jest/pull/5318)) +- `[jest-runner]` Move test summary to after coverage report ([#4512](https://github.com/facebook/jest/pull/4512)) +- `[jest-cli]` Added `--notifyMode` to specify when to be notified. ([#5125](https://github.com/facebook/jest/pull/5125)) +- `[diff-sequences]` New package compares items in two sequences to find a **longest common subsequence**. ([#5407](https://github.com/facebook/jest/pull/5407)) +- `[jest-matcher-utils]` Add `comment` option to `matcherHint` function ([#5437](https://github.com/facebook/jest/pull/5437)) +- `[jest-config]` Allow lastComit and changedFilesWithAncestor via JSON config ([#5476](https://github.com/facebook/jest/pull/5476)) +- `[jest-util]` Add deletion to `process.env` as well ([#5466](https://github.com/facebook/jest/pull/5466)) +- `[jest-util]` Add case-insensitive getters/setters to `process.env` ([#5465](https://github.com/facebook/jest/pull/5465)) +- `[jest-mock]` Add util methods to create async functions. ([#5318](https://github.com/facebook/jest/pull/5318)) ### Fixes -* `[jest-cli]` Add trailing slash when checking root folder ([#5464](https://github.com/facebook/jest/pull/5464)) -* `[jest-cli]` Hide interactive mode if there are no failed snapshot tests ([#5450](https://github.com/facebook/jest/pull/5450)) -* `[babel-jest]` Remove retainLines from babel-jest ([#5439](https://github.com/facebook/jest/pull/5439)) -* `[jest-cli]` Glob patterns ignore non-`require`-able files (e.g. `README.md`) ([#5199](https://github.com/facebook/jest/issues/5199)) -* `[jest-mock]` Add backticks support (\`\`) to `mock` a certain package via the `__mocks__` folder. ([#5426](https://github.com/facebook/jest/pull/5426)) -* `[jest-message-util]` Prevent an `ENOENT` crash when the test file contained a malformed source-map. ([#5405](https://github.com/facebook/jest/pull/5405)). -* `[jest]` Add `import-local` to `jest` package. ([#5353](https://github.com/facebook/jest/pull/5353)) -* `[expect]` Support class instances in `.toHaveProperty()` and `.toMatchObject` matcher. ([#5367](https://github.com/facebook/jest/pull/5367)) -* `[jest-cli]` Fix npm update command for snapshot summary. ([#5376](https://github.com/facebook/jest/pull/5376), [5389](https://github.com/facebook/jest/pull/5389/)) -* `[expect]` Make `rejects` and `resolves` synchronously validate its argument. ([#5364](https://github.com/facebook/jest/pull/5364)) -* `[docs]` Add tutorial page for ES6 class mocks. ([#5383](https://github.com/facebook/jest/pull/5383)) -* `[jest-resolve]` Search required modules in node_modules and then in custom paths. ([#5403](https://github.com/facebook/jest/pull/5403)) -* `[jest-resolve]` Get builtin modules from node core. ([#5411](https://github.com/facebook/jest/pull/5411)) -* `[jest-resolve]` Detect and preserve absolute paths in `moduleDirectories`. Do not generate additional (invalid) paths by prepending each ancestor of `cwd` to the absolute path. Additionally, this fixes functionality in Windows OS. ([#5398](https://github.com/facebook/jest/pull/5398)) +- `[jest-cli]` Add trailing slash when checking root folder ([#5464](https://github.com/facebook/jest/pull/5464)) +- `[jest-cli]` Hide interactive mode if there are no failed snapshot tests ([#5450](https://github.com/facebook/jest/pull/5450)) +- `[babel-jest]` Remove retainLines from babel-jest ([#5439](https://github.com/facebook/jest/pull/5439)) +- `[jest-cli]` Glob patterns ignore non-`require`-able files (e.g. `README.md`) ([#5199](https://github.com/facebook/jest/issues/5199)) +- `[jest-mock]` Add backticks support (\`\`) to `mock` a certain package via the `__mocks__` folder. ([#5426](https://github.com/facebook/jest/pull/5426)) +- `[jest-message-util]` Prevent an `ENOENT` crash when the test file contained a malformed source-map. ([#5405](https://github.com/facebook/jest/pull/5405)). +- `[jest]` Add `import-local` to `jest` package. ([#5353](https://github.com/facebook/jest/pull/5353)) +- `[expect]` Support class instances in `.toHaveProperty()` and `.toMatchObject` matcher. ([#5367](https://github.com/facebook/jest/pull/5367)) +- `[jest-cli]` Fix npm update command for snapshot summary. ([#5376](https://github.com/facebook/jest/pull/5376), [5389](https://github.com/facebook/jest/pull/5389/)) +- `[expect]` Make `rejects` and `resolves` synchronously validate its argument. ([#5364](https://github.com/facebook/jest/pull/5364)) +- `[docs]` Add tutorial page for ES6 class mocks. ([#5383](https://github.com/facebook/jest/pull/5383)) +- `[jest-resolve]` Search required modules in node_modules and then in custom paths. ([#5403](https://github.com/facebook/jest/pull/5403)) +- `[jest-resolve]` Get builtin modules from node core. ([#5411](https://github.com/facebook/jest/pull/5411)) +- `[jest-resolve]` Detect and preserve absolute paths in `moduleDirectories`. Do not generate additional (invalid) paths by prepending each ancestor of `cwd` to the absolute path. Additionally, this fixes functionality in Windows OS. ([#5398](https://github.com/facebook/jest/pull/5398)) ### Chore & Maintenance -* `[jest-util]` Implement watch plugins ([#5399](https://github.com/facebook/jest/pull/5399)) +- `[jest-util]` Implement watch plugins ([#5399](https://github.com/facebook/jest/pull/5399)) ## jest 22.1.4 ### Fixes -* `[jest-util]` Add "debug" method to "console" implementations ([#5350](https://github.com/facebook/jest/pull/5350)) -* `[jest-resolve]` Add condition to avoid infinite loop when node module package main is ".". ([#5344)](https://github.com/facebook/jest/pull/5344) +- `[jest-util]` Add "debug" method to "console" implementations ([#5350](https://github.com/facebook/jest/pull/5350)) +- `[jest-resolve]` Add condition to avoid infinite loop when node module package main is ".". ([#5344)](https://github.com/facebook/jest/pull/5344) ### Features -* `[jest-cli]` `--changedSince`: allow selectively running tests for code changed since arbitrary revisions. ([#5312](https://github.com/facebook/jest/pull/5312)) +- `[jest-cli]` `--changedSince`: allow selectively running tests for code changed since arbitrary revisions. ([#5312](https://github.com/facebook/jest/pull/5312)) ## jest 22.1.3 ### Fixes -* `[jest-cli]` Check if the file belongs to the checked project before adding it to the list, also checking that the file name is not explicitly blacklisted ([#5341](https://github.com/facebook/jest/pull/5341)) -* `[jest-editor-support]` Add option to spawn command in shell ([#5340](https://github.com/facebook/jest/pull/5340)) +- `[jest-cli]` Check if the file belongs to the checked project before adding it to the list, also checking that the file name is not explicitly blacklisted ([#5341](https://github.com/facebook/jest/pull/5341)) +- `[jest-editor-support]` Add option to spawn command in shell ([#5340](https://github.com/facebook/jest/pull/5340)) ## jest 22.1.2 ### Fixes -* `[jest-cli]` Check if the file belongs to the checked project before adding it to the list ([#5335](https://github.com/facebook/jest/pull/5335)) -* `[jest-cli]` Fix `EISDIR` when a directory is passed as an argument to `jest`. ([#5317](https://github.com/facebook/jest/pull/5317)) -* `[jest-config]` Added restoreMocks config option. ([#5327](https://github.com/facebook/jest/pull/5327)) +- `[jest-cli]` Check if the file belongs to the checked project before adding it to the list ([#5335](https://github.com/facebook/jest/pull/5335)) +- `[jest-cli]` Fix `EISDIR` when a directory is passed as an argument to `jest`. ([#5317](https://github.com/facebook/jest/pull/5317)) +- `[jest-config]` Added restoreMocks config option. ([#5327](https://github.com/facebook/jest/pull/5327)) ## jest 22.1.1 ### Fixes -* `[*]` Move from "process.exit" to "exit. ([#5313](https://github.com/facebook/jest/pull/5313)) +- `[*]` Move from "process.exit" to "exit. ([#5313](https://github.com/facebook/jest/pull/5313)) ## jest 22.1.0 ### Features -* `[jest-cli]` Make Jest exit without an error when no tests are found in the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options having been passed to the CLI -* `[jest-cli]` Add interactive snapshot mode ([#3831](https://github.com/facebook/jest/pull/3831)) +- `[jest-cli]` Make Jest exit without an error when no tests are found in the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options having been passed to the CLI +- `[jest-cli]` Add interactive snapshot mode ([#3831](https://github.com/facebook/jest/pull/3831)) ### Fixes -* `[jest-cli]` Use `import-local` to support global Jest installations. ([#5304](https://github.com/facebook/jest/pull/5304)) -* `[jest-runner]` Fix memory leak in coverage reporting ([#5289](https://github.com/facebook/jest/pull/5289)) -* `[docs]` Update mention of the minimal version of node supported ([#4947](https://github.com/facebook/jest/issues/4947)) -* `[jest-cli]` Fix missing newline in console message ([#5308](https://github.com/facebook/jest/pull/5308)) -* `[jest-cli]` `--lastCommit` and `--changedFilesWithAncestor` now take effect even when `--onlyChanged` is not specified. ([#5307](https://github.com/facebook/jest/pull/5307)) +- `[jest-cli]` Use `import-local` to support global Jest installations. ([#5304](https://github.com/facebook/jest/pull/5304)) +- `[jest-runner]` Fix memory leak in coverage reporting ([#5289](https://github.com/facebook/jest/pull/5289)) +- `[docs]` Update mention of the minimal version of node supported ([#4947](https://github.com/facebook/jest/issues/4947)) +- `[jest-cli]` Fix missing newline in console message ([#5308](https://github.com/facebook/jest/pull/5308)) +- `[jest-cli]` `--lastCommit` and `--changedFilesWithAncestor` now take effect even when `--onlyChanged` is not specified. ([#5307](https://github.com/facebook/jest/pull/5307)) ### Chore & Maintenance -* `[filenames]` Standardize folder names under `integration-tests/` ([#5298](https://github.com/facebook/jest/pull/5298)) +- `[filenames]` Standardize folder names under `integration-tests/` ([#5298](https://github.com/facebook/jest/pull/5298)) ## jest 22.0.6 ### Fixes -* `[jest-jasmine2]` Fix memory leak in snapshot reporting ([#5279](https://github.com/facebook/jest/pull/5279)) -* `[jest-config]` Fix breaking change in `--testPathPattern` ([#5269](https://github.com/facebook/jest/pull/5269)) -* `[docs]` Document caveat with mocks, Enzyme, snapshots and React 16 ([#5258](https://github.com/facebook/jest/issues/5258)) +- `[jest-jasmine2]` Fix memory leak in snapshot reporting ([#5279](https://github.com/facebook/jest/pull/5279)) +- `[jest-config]` Fix breaking change in `--testPathPattern` ([#5269](https://github.com/facebook/jest/pull/5269)) +- `[docs]` Document caveat with mocks, Enzyme, snapshots and React 16 ([#5258](https://github.com/facebook/jest/issues/5258)) ## jest 22.0.5 ### Fixes -* `[jest-leak-detector]` Removed the reference to `weak`. Now, parent projects must install it by hand for the module to work. -* `[expect]` Fail test when the types of `stringContaining` and `stringMatching` matchers do not match. ([#5069](https://github.com/facebook/jest/pull/5069)) -* `[jest-cli]` Treat dumb terminals as noninteractive ([#5237](https://github.com/facebook/jest/pull/5237)) -* `[jest-cli]` `jest --onlyChanged --changedFilesWithAncestor` now also works with git. ([#5189](https://github.com/facebook/jest/pull/5189)) -* `[jest-config]` fix unexpected condition to avoid infinite recursion in Windows platform. ([#5161](https://github.com/facebook/jest/pull/5161)) -* `[jest-config]` Escape parentheses and other glob characters in `rootDir` before interpolating with `testMatch`. ([#4838](https://github.com/facebook/jest/issues/4838)) -* `[jest-regex-util]` Fix breaking change in `--testPathPattern` ([#5230](https://github.com/facebook/jest/pull/5230)) -* `[expect]` Do not override `Error` stack (with `Error.captureStackTrace`) for custom matchers. ([#5162](https://github.com/facebook/jest/pull/5162)) -* `[pretty-format]` Pretty format for DOMStringMap and NamedNodeMap ([#5233](https://github.com/facebook/jest/pull/5233)) -* `[jest-cli]` Use a better console-clearing string on Windows ([#5251](https://github.com/facebook/jest/pull/5251)) +- `[jest-leak-detector]` Removed the reference to `weak`. Now, parent projects must install it by hand for the module to work. +- `[expect]` Fail test when the types of `stringContaining` and `stringMatching` matchers do not match. ([#5069](https://github.com/facebook/jest/pull/5069)) +- `[jest-cli]` Treat dumb terminals as noninteractive ([#5237](https://github.com/facebook/jest/pull/5237)) +- `[jest-cli]` `jest --onlyChanged --changedFilesWithAncestor` now also works with git. ([#5189](https://github.com/facebook/jest/pull/5189)) +- `[jest-config]` fix unexpected condition to avoid infinite recursion in Windows platform. ([#5161](https://github.com/facebook/jest/pull/5161)) +- `[jest-config]` Escape parentheses and other glob characters in `rootDir` before interpolating with `testMatch`. ([#4838](https://github.com/facebook/jest/issues/4838)) +- `[jest-regex-util]` Fix breaking change in `--testPathPattern` ([#5230](https://github.com/facebook/jest/pull/5230)) +- `[expect]` Do not override `Error` stack (with `Error.captureStackTrace`) for custom matchers. ([#5162](https://github.com/facebook/jest/pull/5162)) +- `[pretty-format]` Pretty format for DOMStringMap and NamedNodeMap ([#5233](https://github.com/facebook/jest/pull/5233)) +- `[jest-cli]` Use a better console-clearing string on Windows ([#5251](https://github.com/facebook/jest/pull/5251)) ### Features -* `[jest-jasmine]` Allowed classes and functions as `describe` names. ([#5154](https://github.com/facebook/jest/pull/5154)) -* `[jest-jasmine2]` Support generator functions as specs. ([#5166](https://github.com/facebook/jest/pull/5166)) -* `[jest-jasmine2]` Allow `spyOn` with getters and setters. ([#5107](https://github.com/facebook/jest/pull/5107)) -* `[jest-config]` Allow configuration objects inside `projects` array ([#5176](https://github.com/facebook/jest/pull/5176)) -* `[expect]` Add support to `.toHaveProperty` matcher to accept the keyPath argument as an array of properties/indices. ([#5220](https://github.com/facebook/jest/pull/5220)) -* `[docs]` Add documentation for .toHaveProperty matcher to accept the keyPath argument as an array of properties/indices. ([#5220](https://github.com/facebook/jest/pull/5220)) -* `[jest-runner]` test environments are now passed a new `options` parameter. Currently this only has the `console` which is the test console that Jest will expose to tests. ([#5223](https://github.com/facebook/jest/issues/5223)) -* `[jest-environment-jsdom]` pass the `options.console` to a custom instance of `virtualConsole` so jsdom is using the same console as the test. ([#5223](https://github.com/facebook/jest/issues/5223)) +- `[jest-jasmine]` Allowed classes and functions as `describe` names. ([#5154](https://github.com/facebook/jest/pull/5154)) +- `[jest-jasmine2]` Support generator functions as specs. ([#5166](https://github.com/facebook/jest/pull/5166)) +- `[jest-jasmine2]` Allow `spyOn` with getters and setters. ([#5107](https://github.com/facebook/jest/pull/5107)) +- `[jest-config]` Allow configuration objects inside `projects` array ([#5176](https://github.com/facebook/jest/pull/5176)) +- `[expect]` Add support to `.toHaveProperty` matcher to accept the keyPath argument as an array of properties/indices. ([#5220](https://github.com/facebook/jest/pull/5220)) +- `[docs]` Add documentation for .toHaveProperty matcher to accept the keyPath argument as an array of properties/indices. ([#5220](https://github.com/facebook/jest/pull/5220)) +- `[jest-runner]` test environments are now passed a new `options` parameter. Currently this only has the `console` which is the test console that Jest will expose to tests. ([#5223](https://github.com/facebook/jest/issues/5223)) +- `[jest-environment-jsdom]` pass the `options.console` to a custom instance of `virtualConsole` so jsdom is using the same console as the test. ([#5223](https://github.com/facebook/jest/issues/5223)) ### Chore & Maintenance -* `[docs]` Describe the order of execution of describe and test blocks. ([#5217](https://github.com/facebook/jest/pull/5217), [#5238](https://github.com/facebook/jest/pull/5238)) -* `[docs]` Add a note on `moduleNameMapper` ordering. ([#5249](https://github.com/facebook/jest/pull/5249)) +- `[docs]` Describe the order of execution of describe and test blocks. ([#5217](https://github.com/facebook/jest/pull/5217), [#5238](https://github.com/facebook/jest/pull/5238)) +- `[docs]` Add a note on `moduleNameMapper` ordering. ([#5249](https://github.com/facebook/jest/pull/5249)) ## jest 22.0.4 ### Fixes -* `[jest-cli]` New line before quitting watch mode. ([#5158](https://github.com/facebook/jest/pull/5158)) +- `[jest-cli]` New line before quitting watch mode. ([#5158](https://github.com/facebook/jest/pull/5158)) ### Features -* `[babel-jest]` moduleFileExtensions not passed to babel transformer. ([#5110](https://github.com/facebook/jest/pull/5110)) +- `[babel-jest]` moduleFileExtensions not passed to babel transformer. ([#5110](https://github.com/facebook/jest/pull/5110)) ### Chore & Maintenance -* `[*]` Tweaks to better support Node 4 ([#5142](https://github.com/facebook/jest/pull/5142)) +- `[*]` Tweaks to better support Node 4 ([#5142](https://github.com/facebook/jest/pull/5142)) ## jest 22.0.2 && 22.0.3 ### Chore & Maintenance -* `[*]` Tweaks to better support Node 4 ([#5134](https://github.com/facebook/jest/pull/5134)) +- `[*]` Tweaks to better support Node 4 ([#5134](https://github.com/facebook/jest/pull/5134)) ## jest 22.0.1 ### Fixes -* `[jest-runtime]` fix error for test files providing coverage. ([#5117](https://github.com/facebook/jest/pull/5117)) +- `[jest-runtime]` fix error for test files providing coverage. ([#5117](https://github.com/facebook/jest/pull/5117)) ### Features -* `[jest-config]` Add `forceCoverageMatch` to allow collecting coverage from ignored files. ([#5081](https://github.com/facebook/jest/pull/5081)) +- `[jest-config]` Add `forceCoverageMatch` to allow collecting coverage from ignored files. ([#5081](https://github.com/facebook/jest/pull/5081)) ## jest 22.0.0 ### Fixes -* `[jest-resolve]` Use `module.builtinModules` as `BUILTIN_MODULES` when it exists -* `[jest-worker]` Remove `debug` and `inspect` flags from the arguments sent to the child ([#5068](https://github.com/facebook/jest/pull/5068)) -* `[jest-config]` Use all `--testPathPattern` and `` args in `testPathPattern` ([#5066](https://github.com/facebook/jest/pull/5066)) -* `[jest-cli]` Do not support `--watch` inside non-version-controlled environments ([#5060](https://github.com/facebook/jest/pull/5060)) -* `[jest-config]` Escape Windows path separator in testPathPattern CLI arguments ([#5054](https://github.com/facebook/jest/pull/5054) -* `[jest-jasmine]` Register sourcemaps as node environment to improve performance with jsdom ([#5045](https://github.com/facebook/jest/pull/5045)) -* `[pretty-format]` Do not call toJSON recursively ([#5044](https://github.com/facebook/jest/pull/5044)) -* `[pretty-format]` Fix errors when identity-obj-proxy mocks CSS Modules ([#4935](https://github.com/facebook/jest/pull/4935)) -* `[babel-jest]` Fix support for namespaced babel version 7 ([#4918](https://github.com/facebook/jest/pull/4918)) -* `[expect]` fix .toThrow for promises ([#4884](https://github.com/facebook/jest/pull/4884)) -* `[jest-docblock]` pragmas should preserve urls ([#4837](https://github.com/facebook/jest/pull/4629)) -* `[jest-cli]` Check if `npm_lifecycle_script` calls Jest directly ([#4629](https://github.com/facebook/jest/pull/4629)) -* `[jest-cli]` Fix --showConfig to show all configs ([#4494](https://github.com/facebook/jest/pull/4494)) -* `[jest-cli]` Throw if `maxWorkers` doesn't have a value ([#4591](https://github.com/facebook/jest/pull/4591)) -* `[jest-cli]` Use `fs.realpathSync.native` if available ([#5031](https://github.com/facebook/jest/pull/5031)) -* `[jest-config]` Fix `--passWithNoTests` ([#4639](https://github.com/facebook/jest/pull/4639)) -* `[jest-config]` Support `rootDir` tag in testEnvironment ([#4579](https://github.com/facebook/jest/pull/4579)) -* `[jest-editor-support]` Fix `--showConfig` to support jest 20 and jest 21 ([#4575](https://github.com/facebook/jest/pull/4575)) -* `[jest-editor-support]` Fix editor support test for node 4 ([#4640](https://github.com/facebook/jest/pull/4640)) -* `[jest-mock]` Support mocking constructor in `mockImplementationOnce` ([#4599](https://github.com/facebook/jest/pull/4599)) -* `[jest-runtime]` Fix manual user mocks not working with custom resolver ([#4489](https://github.com/facebook/jest/pull/4489)) -* `[jest-util]` Fix `runOnlyPendingTimers` for `setTimeout` inside `setImmediate` ([#4608](https://github.com/facebook/jest/pull/4608)) -* `[jest-message-util]` Always remove node internals from stacktraces ([#4695](https://github.com/facebook/jest/pull/4695)) -* `[jest-resolve]` changes method of determining builtin modules to include missing builtins ([#4740](https://github.com/facebook/jest/pull/4740)) -* `[pretty-format]` Prevent error in pretty-format for window in jsdom test env ([#4750](https://github.com/facebook/jest/pull/4750)) -* `[jest-resolve]` Preserve module identity for symlinks ([#4761](https://github.com/facebook/jest/pull/4761)) -* `[jest-config]` Include error message for `preset` json ([#4766](https://github.com/facebook/jest/pull/4766)) -* `[pretty-format]` Throw `PrettyFormatPluginError` if a plugin halts with an exception ([#4787](https://github.com/facebook/jest/pull/4787)) -* `[expect]` Keep the stack trace unchanged when `PrettyFormatPluginError` is thrown by pretty-format ([#4787](https://github.com/facebook/jest/pull/4787)) -* `[jest-environment-jsdom]` Fix asynchronous test will fail due to timeout issue. ([#4669](https://github.com/facebook/jest/pull/4669)) -* `[jest-cli]` Fix `--onlyChanged` path case sensitivity on Windows platform ([#4730](https://github.com/facebook/jest/pull/4730)) -* `[jest-runtime]` Use realpath to match transformers ([#5000](https://github.com/facebook/jest/pull/5000)) -* `[expect]` [**BREAKING**] Replace identity equality with Object.is in toBe matcher ([#4917](https://github.com/facebook/jest/pull/4917)) +- `[jest-resolve]` Use `module.builtinModules` as `BUILTIN_MODULES` when it exists +- `[jest-worker]` Remove `debug` and `inspect` flags from the arguments sent to the child ([#5068](https://github.com/facebook/jest/pull/5068)) +- `[jest-config]` Use all `--testPathPattern` and `` args in `testPathPattern` ([#5066](https://github.com/facebook/jest/pull/5066)) +- `[jest-cli]` Do not support `--watch` inside non-version-controlled environments ([#5060](https://github.com/facebook/jest/pull/5060)) +- `[jest-config]` Escape Windows path separator in testPathPattern CLI arguments ([#5054](https://github.com/facebook/jest/pull/5054) +- `[jest-jasmine]` Register sourcemaps as node environment to improve performance with jsdom ([#5045](https://github.com/facebook/jest/pull/5045)) +- `[pretty-format]` Do not call toJSON recursively ([#5044](https://github.com/facebook/jest/pull/5044)) +- `[pretty-format]` Fix errors when identity-obj-proxy mocks CSS Modules ([#4935](https://github.com/facebook/jest/pull/4935)) +- `[babel-jest]` Fix support for namespaced babel version 7 ([#4918](https://github.com/facebook/jest/pull/4918)) +- `[expect]` fix .toThrow for promises ([#4884](https://github.com/facebook/jest/pull/4884)) +- `[jest-docblock]` pragmas should preserve urls ([#4837](https://github.com/facebook/jest/pull/4629)) +- `[jest-cli]` Check if `npm_lifecycle_script` calls Jest directly ([#4629](https://github.com/facebook/jest/pull/4629)) +- `[jest-cli]` Fix --showConfig to show all configs ([#4494](https://github.com/facebook/jest/pull/4494)) +- `[jest-cli]` Throw if `maxWorkers` doesn't have a value ([#4591](https://github.com/facebook/jest/pull/4591)) +- `[jest-cli]` Use `fs.realpathSync.native` if available ([#5031](https://github.com/facebook/jest/pull/5031)) +- `[jest-config]` Fix `--passWithNoTests` ([#4639](https://github.com/facebook/jest/pull/4639)) +- `[jest-config]` Support `rootDir` tag in testEnvironment ([#4579](https://github.com/facebook/jest/pull/4579)) +- `[jest-editor-support]` Fix `--showConfig` to support jest 20 and jest 21 ([#4575](https://github.com/facebook/jest/pull/4575)) +- `[jest-editor-support]` Fix editor support test for node 4 ([#4640](https://github.com/facebook/jest/pull/4640)) +- `[jest-mock]` Support mocking constructor in `mockImplementationOnce` ([#4599](https://github.com/facebook/jest/pull/4599)) +- `[jest-runtime]` Fix manual user mocks not working with custom resolver ([#4489](https://github.com/facebook/jest/pull/4489)) +- `[jest-util]` Fix `runOnlyPendingTimers` for `setTimeout` inside `setImmediate` ([#4608](https://github.com/facebook/jest/pull/4608)) +- `[jest-message-util]` Always remove node internals from stacktraces ([#4695](https://github.com/facebook/jest/pull/4695)) +- `[jest-resolve]` changes method of determining builtin modules to include missing builtins ([#4740](https://github.com/facebook/jest/pull/4740)) +- `[pretty-format]` Prevent error in pretty-format for window in jsdom test env ([#4750](https://github.com/facebook/jest/pull/4750)) +- `[jest-resolve]` Preserve module identity for symlinks ([#4761](https://github.com/facebook/jest/pull/4761)) +- `[jest-config]` Include error message for `preset` json ([#4766](https://github.com/facebook/jest/pull/4766)) +- `[pretty-format]` Throw `PrettyFormatPluginError` if a plugin halts with an exception ([#4787](https://github.com/facebook/jest/pull/4787)) +- `[expect]` Keep the stack trace unchanged when `PrettyFormatPluginError` is thrown by pretty-format ([#4787](https://github.com/facebook/jest/pull/4787)) +- `[jest-environment-jsdom]` Fix asynchronous test will fail due to timeout issue. ([#4669](https://github.com/facebook/jest/pull/4669)) +- `[jest-cli]` Fix `--onlyChanged` path case sensitivity on Windows platform ([#4730](https://github.com/facebook/jest/pull/4730)) +- `[jest-runtime]` Use realpath to match transformers ([#5000](https://github.com/facebook/jest/pull/5000)) +- `[expect]` [**BREAKING**] Replace identity equality with Object.is in toBe matcher ([#4917](https://github.com/facebook/jest/pull/4917)) ### Features -* `[jest-message-util]` Add codeframe to test assertion failures ([#5087](https://github.com/facebook/jest/pull/5087)) -* `[jest-config]` Add Global Setup/Teardown options ([#4716](https://github.com/facebook/jest/pull/4716)) -* `[jest-config]` Add `testEnvironmentOptions` to apply to jsdom options or node context. ([#5003](https://github.com/facebook/jest/pull/5003)) -* `[jest-jasmine2]` Update Timeout error message to `jest.timeout` and display current timeout value ([#4990](https://github.com/facebook/jest/pull/4990)) -* `[jest-runner]` Enable experimental detection of leaked contexts ([#4895](https://github.com/facebook/jest/pull/4895)) -* `[jest-cli]` Add combined coverage threshold for directories. ([#4885](https://github.com/facebook/jest/pull/4885)) -* `[jest-mock]` Add `timestamps` to mock state. ([#4866](https://github.com/facebook/jest/pull/4866)) -* `[eslint-plugin-jest]` Add `prefer-to-have-length` lint rule. ([#4771](https://github.com/facebook/jest/pull/4771)) -* `[jest-environment-jsdom]` [**BREAKING**] Upgrade to JSDOM@11 ([#4770](https://github.com/facebook/jest/pull/4770)) -* `[jest-environment-*]` [**BREAKING**] Add Async Test Environment APIs, dispose is now teardown ([#4506](https://github.com/facebook/jest/pull/4506)) -* `[jest-cli]` Add an option to clear the cache ([#4430](https://github.com/facebook/jest/pull/4430)) -* `[babel-plugin-jest-hoist]` Improve error message, that the second argument of `jest.mock` must be an inline function ([#4593](https://github.com/facebook/jest/pull/4593)) -* `[jest-snapshot]` [**BREAKING**] Concatenate name of test and snapshot ([#4460](https://github.com/facebook/jest/pull/4460)) -* `[jest-cli]` [**BREAKING**] Fail if no tests are found ([#3672](https://github.com/facebook/jest/pull/3672)) -* `[jest-diff]` Highlight only last of odd length leading spaces ([#4558](https://github.com/facebook/jest/pull/4558)) -* `[jest-docblock]` Add `docblock.print()` ([#4517](https://github.com/facebook/jest/pull/4517)) -* `[jest-docblock]` Add `strip` ([#4571](https://github.com/facebook/jest/pull/4571)) -* `[jest-docblock]` Preserve leading whitespace in docblock comments ([#4576](https://github.com/facebook/jest/pull/4576)) -* `[jest-docblock]` remove leading newlines from `parswWithComments().comments` ([#4610](https://github.com/facebook/jest/pull/4610)) -* `[jest-editor-support]` Add Snapshots metadata ([#4570](https://github.com/facebook/jest/pull/4570)) -* `[jest-editor-support]` Adds an 'any' to the typedef for `updateFileWithJestStatus` ([#4636](https://github.com/facebook/jest/pull/4636)) -* `[jest-editor-support]` Better monorepo support ([#4572](https://github.com/facebook/jest/pull/4572)) -* `[jest-environment-jsdom]` Add simple rAF polyfill in jsdom environment to work with React 16 ([#4568](https://github.com/facebook/jest/pull/4568)) -* `[jest-environment-node]` Implement node Timer api ([#4622](https://github.com/facebook/jest/pull/4622)) -* `[jest-jasmine2]` Add testPath to reporter callbacks ([#4594](https://github.com/facebook/jest/pull/4594)) -* `[jest-mock]` Added support for naming mocked functions with `.mockName(value)` and `.mockGetName()` ([#4586](https://github.com/facebook/jest/pull/4586)) -* `[jest-runtime]` Add `module.loaded`, and make `module.require` not enumerable ([#4623](https://github.com/facebook/jest/pull/4623)) -* `[jest-runtime]` Add `module.parent` ([#4614](https://github.com/facebook/jest/pull/4614)) -* `[jest-runtime]` Support sourcemaps in transformers ([#3458](https://github.com/facebook/jest/pull/3458)) -* `[jest-snapshot]` [**BREAKING**] Add a serializer for `jest.fn` to allow a snapshot of a jest mock ([#4668](https://github.com/facebook/jest/pull/4668)) -* `[jest-worker]` Initial version of parallel worker abstraction, say hello! ([#4497](https://github.com/facebook/jest/pull/4497)) -* `[jest-jasmine2]` Add `testLocationInResults` flag to add location information per spec to test results ([#4782](https://github.com/facebook/jest/pull/4782)) -* `[jest-environment-jsdom]` Update JSOM to 11.4, which includes built-in support for `requestAnimationFrame` ([#4919](https://github.com/facebook/jest/pull/4919)) -* `[jest-cli]` Hide watch usage output when running on non-interactive environments ([#4958](https://github.com/facebook/jest/pull/4958)) -* `[jest-snapshot]` Promises support for `toThrowErrorMatchingSnapshot` ([#4946](https://github.com/facebook/jest/pull/4946)) -* `[jest-cli]` Explain which snapshots are obsolete ([#5005](https://github.com/facebook/jest/pull/5005)) +- `[jest-message-util]` Add codeframe to test assertion failures ([#5087](https://github.com/facebook/jest/pull/5087)) +- `[jest-config]` Add Global Setup/Teardown options ([#4716](https://github.com/facebook/jest/pull/4716)) +- `[jest-config]` Add `testEnvironmentOptions` to apply to jsdom options or node context. ([#5003](https://github.com/facebook/jest/pull/5003)) +- `[jest-jasmine2]` Update Timeout error message to `jest.timeout` and display current timeout value ([#4990](https://github.com/facebook/jest/pull/4990)) +- `[jest-runner]` Enable experimental detection of leaked contexts ([#4895](https://github.com/facebook/jest/pull/4895)) +- `[jest-cli]` Add combined coverage threshold for directories. ([#4885](https://github.com/facebook/jest/pull/4885)) +- `[jest-mock]` Add `timestamps` to mock state. ([#4866](https://github.com/facebook/jest/pull/4866)) +- `[eslint-plugin-jest]` Add `prefer-to-have-length` lint rule. ([#4771](https://github.com/facebook/jest/pull/4771)) +- `[jest-environment-jsdom]` [**BREAKING**] Upgrade to JSDOM@11 ([#4770](https://github.com/facebook/jest/pull/4770)) +- `[jest-environment-*]` [**BREAKING**] Add Async Test Environment APIs, dispose is now teardown ([#4506](https://github.com/facebook/jest/pull/4506)) +- `[jest-cli]` Add an option to clear the cache ([#4430](https://github.com/facebook/jest/pull/4430)) +- `[babel-plugin-jest-hoist]` Improve error message, that the second argument of `jest.mock` must be an inline function ([#4593](https://github.com/facebook/jest/pull/4593)) +- `[jest-snapshot]` [**BREAKING**] Concatenate name of test and snapshot ([#4460](https://github.com/facebook/jest/pull/4460)) +- `[jest-cli]` [**BREAKING**] Fail if no tests are found ([#3672](https://github.com/facebook/jest/pull/3672)) +- `[jest-diff]` Highlight only last of odd length leading spaces ([#4558](https://github.com/facebook/jest/pull/4558)) +- `[jest-docblock]` Add `docblock.print()` ([#4517](https://github.com/facebook/jest/pull/4517)) +- `[jest-docblock]` Add `strip` ([#4571](https://github.com/facebook/jest/pull/4571)) +- `[jest-docblock]` Preserve leading whitespace in docblock comments ([#4576](https://github.com/facebook/jest/pull/4576)) +- `[jest-docblock]` remove leading newlines from `parswWithComments().comments` ([#4610](https://github.com/facebook/jest/pull/4610)) +- `[jest-editor-support]` Add Snapshots metadata ([#4570](https://github.com/facebook/jest/pull/4570)) +- `[jest-editor-support]` Adds an 'any' to the typedef for `updateFileWithJestStatus` ([#4636](https://github.com/facebook/jest/pull/4636)) +- `[jest-editor-support]` Better monorepo support ([#4572](https://github.com/facebook/jest/pull/4572)) +- `[jest-environment-jsdom]` Add simple rAF polyfill in jsdom environment to work with React 16 ([#4568](https://github.com/facebook/jest/pull/4568)) +- `[jest-environment-node]` Implement node Timer api ([#4622](https://github.com/facebook/jest/pull/4622)) +- `[jest-jasmine2]` Add testPath to reporter callbacks ([#4594](https://github.com/facebook/jest/pull/4594)) +- `[jest-mock]` Added support for naming mocked functions with `.mockName(value)` and `.mockGetName()` ([#4586](https://github.com/facebook/jest/pull/4586)) +- `[jest-runtime]` Add `module.loaded`, and make `module.require` not enumerable ([#4623](https://github.com/facebook/jest/pull/4623)) +- `[jest-runtime]` Add `module.parent` ([#4614](https://github.com/facebook/jest/pull/4614)) +- `[jest-runtime]` Support sourcemaps in transformers ([#3458](https://github.com/facebook/jest/pull/3458)) +- `[jest-snapshot]` [**BREAKING**] Add a serializer for `jest.fn` to allow a snapshot of a jest mock ([#4668](https://github.com/facebook/jest/pull/4668)) +- `[jest-worker]` Initial version of parallel worker abstraction, say hello! ([#4497](https://github.com/facebook/jest/pull/4497)) +- `[jest-jasmine2]` Add `testLocationInResults` flag to add location information per spec to test results ([#4782](https://github.com/facebook/jest/pull/4782)) +- `[jest-environment-jsdom]` Update JSOM to 11.4, which includes built-in support for `requestAnimationFrame` ([#4919](https://github.com/facebook/jest/pull/4919)) +- `[jest-cli]` Hide watch usage output when running on non-interactive environments ([#4958](https://github.com/facebook/jest/pull/4958)) +- `[jest-snapshot]` Promises support for `toThrowErrorMatchingSnapshot` ([#4946](https://github.com/facebook/jest/pull/4946)) +- `[jest-cli]` Explain which snapshots are obsolete ([#5005](https://github.com/facebook/jest/pull/5005)) ### Chore & Maintenance -* `[docs]` Add guide of using with puppeteer ([#5093](https://github.com/facebook/jest/pull/5093)) -* `[jest-util]` `jest-util` should not depend on `jest-mock` ([#4992](https://github.com/facebook/jest/pull/4992)) -* `[*]` [**BREAKING**] Drop support for Node.js version 4 ([#4769](https://github.com/facebook/jest/pull/4769)) -* `[docs]` Wrap code comments at 80 characters ([#4781](https://github.com/facebook/jest/pull/4781)) -* `[eslint-plugin-jest]` Removed from the Jest core repo, and moved to https://github.com/jest-community/eslint-plugin-jest ([#4867](https://github.com/facebook/jest/pull/4867)) -* `[babel-jest]` Explicitly bump istanbul to newer versions ([#4616](https://github.com/facebook/jest/pull/4616)) -* `[expect]` Upgrade mocha and rollup for browser testing ([#4642](https://github.com/facebook/jest/pull/4642)) -* `[docs]` Add info about `coveragePathIgnorePatterns` ([#4602](https://github.com/facebook/jest/pull/4602)) -* `[docs]` Add Vuejs series of testing with Jest ([#4648](https://github.com/facebook/jest/pull/4648)) -* `[docs]` Mention about optional `done` argument in test function ([#4556](https://github.com/facebook/jest/pull/4556)) -* `[jest-cli]` Bump node-notifier version ([#4609](https://github.com/facebook/jest/pull/4609)) -* `[jest-diff]` Simplify highlight for leading and trailing spaces ([#4553](https://github.com/facebook/jest/pull/4553)) -* `[jest-get-type]` Add support for date ([#4621](https://github.com/facebook/jest/pull/4621)) -* `[jest-matcher-utils]` Call `chalk.inverse` for trailing spaces ([#4578](https://github.com/facebook/jest/pull/4578)) -* `[jest-runtime]` Add `.advanceTimersByTime`; keep `.runTimersToTime()` as an alias. -* `[docs]` Include missing dependency in TestEnvironment sample code -* `[docs]` Add clarification for hook execution order -* `[docs]` Update `expect.anything()` sample code ([#5007](https://github.com/facebook/jest/pull/5007)) +- `[docs]` Add guide of using with puppeteer ([#5093](https://github.com/facebook/jest/pull/5093)) +- `[jest-util]` `jest-util` should not depend on `jest-mock` ([#4992](https://github.com/facebook/jest/pull/4992)) +- `[*]` [**BREAKING**] Drop support for Node.js version 4 ([#4769](https://github.com/facebook/jest/pull/4769)) +- `[docs]` Wrap code comments at 80 characters ([#4781](https://github.com/facebook/jest/pull/4781)) +- `[eslint-plugin-jest]` Removed from the Jest core repo, and moved to https://github.com/jest-community/eslint-plugin-jest ([#4867](https://github.com/facebook/jest/pull/4867)) +- `[babel-jest]` Explicitly bump istanbul to newer versions ([#4616](https://github.com/facebook/jest/pull/4616)) +- `[expect]` Upgrade mocha and rollup for browser testing ([#4642](https://github.com/facebook/jest/pull/4642)) +- `[docs]` Add info about `coveragePathIgnorePatterns` ([#4602](https://github.com/facebook/jest/pull/4602)) +- `[docs]` Add Vuejs series of testing with Jest ([#4648](https://github.com/facebook/jest/pull/4648)) +- `[docs]` Mention about optional `done` argument in test function ([#4556](https://github.com/facebook/jest/pull/4556)) +- `[jest-cli]` Bump node-notifier version ([#4609](https://github.com/facebook/jest/pull/4609)) +- `[jest-diff]` Simplify highlight for leading and trailing spaces ([#4553](https://github.com/facebook/jest/pull/4553)) +- `[jest-get-type]` Add support for date ([#4621](https://github.com/facebook/jest/pull/4621)) +- `[jest-matcher-utils]` Call `chalk.inverse` for trailing spaces ([#4578](https://github.com/facebook/jest/pull/4578)) +- `[jest-runtime]` Add `.advanceTimersByTime`; keep `.runTimersToTime()` as an alias. +- `[docs]` Include missing dependency in TestEnvironment sample code +- `[docs]` Add clarification for hook execution order +- `[docs]` Update `expect.anything()` sample code ([#5007](https://github.com/facebook/jest/pull/5007)) ## jest 21.2.1 -* Fix watchAll not running tests on save ([#4550](https://github.com/facebook/jest/pull/4550)) -* Add missing escape sequences to ConvertAnsi plugin ([#4544](https://github.com/facebook/jest/pull/4544)) +- Fix watchAll not running tests on save ([#4550](https://github.com/facebook/jest/pull/4550)) +- Add missing escape sequences to ConvertAnsi plugin ([#4544](https://github.com/facebook/jest/pull/4544)) ## jest 21.2.0 -* 🃏 Change license from BSD+Patents to MIT. -* Allow eslint-plugin to recognize more disabled tests ([#4533](https://github.com/facebook/jest/pull/4533)) -* Add babel-plugin for object spread syntax to babel-preset-jest ([#4519](https://github.com/facebook/jest/pull/4519)) -* Display outer element and trailing newline consistently in jest-diff ([#4520](https://github.com/facebook/jest/pull/4520)) -* Do not modify stack trace of JestAssertionError ([#4516](https://github.com/facebook/jest/pull/4516)) -* Print errors after test structure in verbose mode ([#4504](https://github.com/facebook/jest/pull/4504)) -* Fix `--silent --verbose` problem ([#4505](https://github.com/facebook/jest/pull/4505)) -* Fix: Reset local state of assertions when using hasAssertions ([#4498](https://github.com/facebook/jest/pull/4498)) -* jest-resolve: Prevent default resolver failure when potential resolution directory does not exist ([#4483](https://github.com/facebook/jest/pull/4483)) +- 🃏 Change license from BSD+Patents to MIT. +- Allow eslint-plugin to recognize more disabled tests ([#4533](https://github.com/facebook/jest/pull/4533)) +- Add babel-plugin for object spread syntax to babel-preset-jest ([#4519](https://github.com/facebook/jest/pull/4519)) +- Display outer element and trailing newline consistently in jest-diff ([#4520](https://github.com/facebook/jest/pull/4520)) +- Do not modify stack trace of JestAssertionError ([#4516](https://github.com/facebook/jest/pull/4516)) +- Print errors after test structure in verbose mode ([#4504](https://github.com/facebook/jest/pull/4504)) +- Fix `--silent --verbose` problem ([#4505](https://github.com/facebook/jest/pull/4505)) +- Fix: Reset local state of assertions when using hasAssertions ([#4498](https://github.com/facebook/jest/pull/4498)) +- jest-resolve: Prevent default resolver failure when potential resolution directory does not exist ([#4483](https://github.com/facebook/jest/pull/4483)) ## jest 21.1.0 -* (minor) Use ES module exports ([#4454](https://github.com/facebook/jest/pull/4454)) -* Allow chaining mockClear and mockReset ([#4475](https://github.com/facebook/jest/pull/4475)) -* Call jest-diff and pretty-format more precisely in toHaveProperty matcher ([#4445](https://github.com/facebook/jest/pull/4445)) -* Expose restoreAllMocks to object ([#4463](https://github.com/facebook/jest/pull/4463)) -* Fix function name cleaning when making mock fn ([#4464](https://github.com/facebook/jest/pull/4464)) -* Fix Map/Set equality checker ([#4404](https://github.com/facebook/jest/pull/4404)) -* Make FUNCTION_NAME_RESERVED_PATTERN stateless ([#4466](https://github.com/facebook/jest/pull/4466)) +- (minor) Use ES module exports ([#4454](https://github.com/facebook/jest/pull/4454)) +- Allow chaining mockClear and mockReset ([#4475](https://github.com/facebook/jest/pull/4475)) +- Call jest-diff and pretty-format more precisely in toHaveProperty matcher ([#4445](https://github.com/facebook/jest/pull/4445)) +- Expose restoreAllMocks to object ([#4463](https://github.com/facebook/jest/pull/4463)) +- Fix function name cleaning when making mock fn ([#4464](https://github.com/facebook/jest/pull/4464)) +- Fix Map/Set equality checker ([#4404](https://github.com/facebook/jest/pull/4404)) +- Make FUNCTION_NAME_RESERVED_PATTERN stateless ([#4466](https://github.com/facebook/jest/pull/4466)) ## jest 21.0.2 -* Take precedence of NODE_PATH when resolving node_modules directories ([#4453](https://github.com/facebook/jest/pull/4453)) -* Fix race condition with --coverage and babel-jest identical file contents edge case ([#4432](https://github.com/facebook/jest/pull/4432)) -* Add extra parameter `--runTestsByPath`. ([#4411](https://github.com/facebook/jest/pull/4411)) -* Upgrade all outdated deps ([#4425](https://github.com/facebook/jest/pull/4425)) +- Take precedence of NODE_PATH when resolving node_modules directories ([#4453](https://github.com/facebook/jest/pull/4453)) +- Fix race condition with --coverage and babel-jest identical file contents edge case ([#4432](https://github.com/facebook/jest/pull/4432)) +- Add extra parameter `--runTestsByPath`. ([#4411](https://github.com/facebook/jest/pull/4411)) +- Upgrade all outdated deps ([#4425](https://github.com/facebook/jest/pull/4425)) ## jest 21.0.1 -* Remove obsolete error ([#4417](https://github.com/facebook/jest/pull/4417)) +- Remove obsolete error ([#4417](https://github.com/facebook/jest/pull/4417)) ## jest 21.0.0 -* Add --changedFilesWithAncestor ([#4070](https://github.com/facebook/jest/pull/4070)) -* Add --findRelatedFiles ([#4131](https://github.com/facebook/jest/pull/4131)) -* Add --onlyChanged tests ([#3977](https://github.com/facebook/jest/pull/3977)) -* Add `contextLines` option to jest-diff ([#4152](https://github.com/facebook/jest/pull/4152)) -* Add alternative serialize API for pretty-format plugins ([#4114](https://github.com/facebook/jest/pull/4114)) -* Add displayName to MPR ([#4327](https://github.com/facebook/jest/pull/4327)) -* Add displayName to TestResult ([#4408](https://github.com/facebook/jest/pull/4408)) -* Add es5 build of pretty-format ([#4075](https://github.com/facebook/jest/pull/4075)) -* Add extra info to no tests for changed files message ([#4188](https://github.com/facebook/jest/pull/4188)) -* Add fake chalk in browser builds in order to support IE10 ([#4367](https://github.com/facebook/jest/pull/4367)) -* Add jest.requireActual ([#4260](https://github.com/facebook/jest/pull/4260)) -* Add maxWorkers to globalConfig ([#4005](https://github.com/facebook/jest/pull/4005)) -* Add skipped tests support for jest-editor-support ([#4346](https://github.com/facebook/jest/pull/4346)) -* Add source map support for better debugging experience ([#3738](https://github.com/facebook/jest/pull/3738)) -* Add support for Error objects in toMatchObject ([#4339](https://github.com/facebook/jest/pull/4339)) -* Add support for Immutable.Record in pretty-format ([#3678](https://github.com/facebook/jest/pull/3678)) -* Add tests for extract_requires on export types ([#4080](https://github.com/facebook/jest/pull/4080)) -* Add that toMatchObject can match arrays ([#3994](https://github.com/facebook/jest/pull/3994)) -* Add watchPathIgnorePatterns to exclude paths to trigger test re-run in watch mode ([#4331](https://github.com/facebook/jest/pull/4331)) -* Adding ancestorTitles property to JSON test output ([#4293](https://github.com/facebook/jest/pull/4293)) -* Allow custom resolver to be used with[out] moduleNameMapper ([#4174](https://github.com/facebook/jest/pull/4174)) -* Avoid parsing `.require(…)` method calls ([#3777](https://github.com/facebook/jest/pull/3777)) -* Avoid unnecessary function declarations and call in pretty-format ([#3962](https://github.com/facebook/jest/pull/3962)) -* Avoid writing to stdout in default reporter if --json is enabled. Fixes #3941 ([#3945](https://github.com/facebook/jest/pull/3945)) -* Better error handling for --config ([#4230](https://github.com/facebook/jest/pull/4230)) -* Call consistent pretty-format plugins within Jest ([#3800](https://github.com/facebook/jest/pull/3800)) -* Change babel-core to peerDependency for compatibility with Babel 7 ([#4162](https://github.com/facebook/jest/pull/4162)) -* Change Promise detection code in jest-circus to support non-global Promise implementations ([#4375](https://github.com/facebook/jest/pull/4375)) -* Changed files eager loading ([#3979](https://github.com/facebook/jest/pull/3979)) -* Check whether we should output to stdout or stderr ([#3953](https://github.com/facebook/jest/pull/3953)) -* Clarify what objects toContain and toContainEqual can be used on ([#4307](https://github.com/facebook/jest/pull/4307)) -* Clean up resolve() logic. Provide useful names for variables and functions. Test that a directory exists before attempting to resolve files within it. ([#4325](https://github.com/facebook/jest/pull/4325)) -* cleanupStackTrace ([#3696](https://github.com/facebook/jest/pull/3696)) -* compare objects with Symbol keys ([#3437](https://github.com/facebook/jest/pull/3437)) -* Complain if expect is passed multiple arguments ([#4237](https://github.com/facebook/jest/pull/4237)) -* Completes nodeCrawl with empty roots ([#3776](https://github.com/facebook/jest/pull/3776)) -* Consistent naming of files ([#3798](https://github.com/facebook/jest/pull/3798)) -* Convert code base to ESM import ([#3778](https://github.com/facebook/jest/pull/3778)) -* Correct summary message for flag --findRelatedTests. ([#4309](https://github.com/facebook/jest/pull/4309)) -* Coverage thresholds can be set up for individual files ([#4185](https://github.com/facebook/jest/pull/4185)) -* custom reporter error handling ([#4051](https://github.com/facebook/jest/pull/4051)) -* Define separate type for pretty-format plugin Options ([#3802](https://github.com/facebook/jest/pull/3802)) -* Delete confusing async keyword ([#3679](https://github.com/facebook/jest/pull/3679)) -* Delete redundant branch in ReactElement and HTMLElement plugins ([#3731](https://github.com/facebook/jest/pull/3731)) -* Don't format node assert errors when there's no 'assert' module ([#4376](https://github.com/facebook/jest/pull/4376)) -* Don't print test summary in --silent ([#4106](https://github.com/facebook/jest/pull/4106)) -* Don't try to build ghost packages ([#3934](https://github.com/facebook/jest/pull/3934)) -* Escape double quotes in attribute values in HTMLElement plugin ([#3797](https://github.com/facebook/jest/pull/3797)) -* Explain how to clear the cache ([#4232](https://github.com/facebook/jest/pull/4232)) -* Factor out common code for collections in pretty-format ([#4184](https://github.com/facebook/jest/pull/4184)) -* Factor out common code for markup in React plugins ([#4171](https://github.com/facebook/jest/pull/4171)) -* Feature/internal resolve ([#4315](https://github.com/facebook/jest/pull/4315)) -* Fix --logHeapUsage ([#4176](https://github.com/facebook/jest/pull/4176)) -* Fix --showConfig to show all project configs ([#4078](https://github.com/facebook/jest/pull/4078)) -* Fix --watchAll ([#4254](https://github.com/facebook/jest/pull/4254)) -* Fix bug when setTimeout is mocked ([#3769](https://github.com/facebook/jest/pull/3769)) -* Fix changedFilesWithAncestor ([#4193](https://github.com/facebook/jest/pull/4193)) -* Fix colors for expected/stored snapshot message ([#3702](https://github.com/facebook/jest/pull/3702)) -* Fix concurrent test failure ([#4159](https://github.com/facebook/jest/pull/4159)) -* Fix for 4286: Compare Maps and Sets by value rather than order ([#4303](https://github.com/facebook/jest/pull/4303)) -* fix forceExit ([#4105](https://github.com/facebook/jest/pull/4105)) -* Fix grammar in React Native docs ([#3838](https://github.com/facebook/jest/pull/3838)) -* Fix inconsistent name of complex values in pretty-format ([#4001](https://github.com/facebook/jest/pull/4001)) -* Fix issue mocking bound method ([#3805](https://github.com/facebook/jest/pull/3805)) -* Fix jest-circus ([#4290](https://github.com/facebook/jest/pull/4290)) -* Fix lint warning in master +- Add --changedFilesWithAncestor ([#4070](https://github.com/facebook/jest/pull/4070)) +- Add --findRelatedFiles ([#4131](https://github.com/facebook/jest/pull/4131)) +- Add --onlyChanged tests ([#3977](https://github.com/facebook/jest/pull/3977)) +- Add `contextLines` option to jest-diff ([#4152](https://github.com/facebook/jest/pull/4152)) +- Add alternative serialize API for pretty-format plugins ([#4114](https://github.com/facebook/jest/pull/4114)) +- Add displayName to MPR ([#4327](https://github.com/facebook/jest/pull/4327)) +- Add displayName to TestResult ([#4408](https://github.com/facebook/jest/pull/4408)) +- Add es5 build of pretty-format ([#4075](https://github.com/facebook/jest/pull/4075)) +- Add extra info to no tests for changed files message ([#4188](https://github.com/facebook/jest/pull/4188)) +- Add fake chalk in browser builds in order to support IE10 ([#4367](https://github.com/facebook/jest/pull/4367)) +- Add jest.requireActual ([#4260](https://github.com/facebook/jest/pull/4260)) +- Add maxWorkers to globalConfig ([#4005](https://github.com/facebook/jest/pull/4005)) +- Add skipped tests support for jest-editor-support ([#4346](https://github.com/facebook/jest/pull/4346)) +- Add source map support for better debugging experience ([#3738](https://github.com/facebook/jest/pull/3738)) +- Add support for Error objects in toMatchObject ([#4339](https://github.com/facebook/jest/pull/4339)) +- Add support for Immutable.Record in pretty-format ([#3678](https://github.com/facebook/jest/pull/3678)) +- Add tests for extract_requires on export types ([#4080](https://github.com/facebook/jest/pull/4080)) +- Add that toMatchObject can match arrays ([#3994](https://github.com/facebook/jest/pull/3994)) +- Add watchPathIgnorePatterns to exclude paths to trigger test re-run in watch mode ([#4331](https://github.com/facebook/jest/pull/4331)) +- Adding ancestorTitles property to JSON test output ([#4293](https://github.com/facebook/jest/pull/4293)) +- Allow custom resolver to be used with[out] moduleNameMapper ([#4174](https://github.com/facebook/jest/pull/4174)) +- Avoid parsing `.require(…)` method calls ([#3777](https://github.com/facebook/jest/pull/3777)) +- Avoid unnecessary function declarations and call in pretty-format ([#3962](https://github.com/facebook/jest/pull/3962)) +- Avoid writing to stdout in default reporter if --json is enabled. Fixes #3941 ([#3945](https://github.com/facebook/jest/pull/3945)) +- Better error handling for --config ([#4230](https://github.com/facebook/jest/pull/4230)) +- Call consistent pretty-format plugins within Jest ([#3800](https://github.com/facebook/jest/pull/3800)) +- Change babel-core to peerDependency for compatibility with Babel 7 ([#4162](https://github.com/facebook/jest/pull/4162)) +- Change Promise detection code in jest-circus to support non-global Promise implementations ([#4375](https://github.com/facebook/jest/pull/4375)) +- Changed files eager loading ([#3979](https://github.com/facebook/jest/pull/3979)) +- Check whether we should output to stdout or stderr ([#3953](https://github.com/facebook/jest/pull/3953)) +- Clarify what objects toContain and toContainEqual can be used on ([#4307](https://github.com/facebook/jest/pull/4307)) +- Clean up resolve() logic. Provide useful names for variables and functions. Test that a directory exists before attempting to resolve files within it. ([#4325](https://github.com/facebook/jest/pull/4325)) +- cleanupStackTrace ([#3696](https://github.com/facebook/jest/pull/3696)) +- compare objects with Symbol keys ([#3437](https://github.com/facebook/jest/pull/3437)) +- Complain if expect is passed multiple arguments ([#4237](https://github.com/facebook/jest/pull/4237)) +- Completes nodeCrawl with empty roots ([#3776](https://github.com/facebook/jest/pull/3776)) +- Consistent naming of files ([#3798](https://github.com/facebook/jest/pull/3798)) +- Convert code base to ESM import ([#3778](https://github.com/facebook/jest/pull/3778)) +- Correct summary message for flag --findRelatedTests. ([#4309](https://github.com/facebook/jest/pull/4309)) +- Coverage thresholds can be set up for individual files ([#4185](https://github.com/facebook/jest/pull/4185)) +- custom reporter error handling ([#4051](https://github.com/facebook/jest/pull/4051)) +- Define separate type for pretty-format plugin Options ([#3802](https://github.com/facebook/jest/pull/3802)) +- Delete confusing async keyword ([#3679](https://github.com/facebook/jest/pull/3679)) +- Delete redundant branch in ReactElement and HTMLElement plugins ([#3731](https://github.com/facebook/jest/pull/3731)) +- Don't format node assert errors when there's no 'assert' module ([#4376](https://github.com/facebook/jest/pull/4376)) +- Don't print test summary in --silent ([#4106](https://github.com/facebook/jest/pull/4106)) +- Don't try to build ghost packages ([#3934](https://github.com/facebook/jest/pull/3934)) +- Escape double quotes in attribute values in HTMLElement plugin ([#3797](https://github.com/facebook/jest/pull/3797)) +- Explain how to clear the cache ([#4232](https://github.com/facebook/jest/pull/4232)) +- Factor out common code for collections in pretty-format ([#4184](https://github.com/facebook/jest/pull/4184)) +- Factor out common code for markup in React plugins ([#4171](https://github.com/facebook/jest/pull/4171)) +- Feature/internal resolve ([#4315](https://github.com/facebook/jest/pull/4315)) +- Fix --logHeapUsage ([#4176](https://github.com/facebook/jest/pull/4176)) +- Fix --showConfig to show all project configs ([#4078](https://github.com/facebook/jest/pull/4078)) +- Fix --watchAll ([#4254](https://github.com/facebook/jest/pull/4254)) +- Fix bug when setTimeout is mocked ([#3769](https://github.com/facebook/jest/pull/3769)) +- Fix changedFilesWithAncestor ([#4193](https://github.com/facebook/jest/pull/4193)) +- Fix colors for expected/stored snapshot message ([#3702](https://github.com/facebook/jest/pull/3702)) +- Fix concurrent test failure ([#4159](https://github.com/facebook/jest/pull/4159)) +- Fix for 4286: Compare Maps and Sets by value rather than order ([#4303](https://github.com/facebook/jest/pull/4303)) +- fix forceExit ([#4105](https://github.com/facebook/jest/pull/4105)) +- Fix grammar in React Native docs ([#3838](https://github.com/facebook/jest/pull/3838)) +- Fix inconsistent name of complex values in pretty-format ([#4001](https://github.com/facebook/jest/pull/4001)) +- Fix issue mocking bound method ([#3805](https://github.com/facebook/jest/pull/3805)) +- Fix jest-circus ([#4290](https://github.com/facebook/jest/pull/4290)) +- Fix lint warning in master ([#4132](https://github.com/facebook/jest/pull/4132)) -* Fix linting ([#3946](https://github.com/facebook/jest/pull/3946)) -* fix merge conflict ([#4144](https://github.com/facebook/jest/pull/4144)) -* Fix minor typo ([#3729](https://github.com/facebook/jest/pull/3729)) -* fix missing console.log messages ([#3895](https://github.com/facebook/jest/pull/3895)) -* fix mock return value ([#3933](https://github.com/facebook/jest/pull/3933)) -* Fix mocking for modules with folders on windows ([#4238](https://github.com/facebook/jest/pull/4238)) -* Fix NODE_PATH resolving for relative paths ([#3616](https://github.com/facebook/jest/pull/3616)) -* Fix options.moduleNameMapper override order with preset ([#3565](https://github.com/facebook/jest/pull/3565) ([#3689](https://github.com/facebook/jest/pull/3689)) -* Fix React PropTypes warning in tests for Immutable plugin ([#4412](https://github.com/facebook/jest/pull/4412)) -* Fix regression in mockReturnValueOnce ([#3857](https://github.com/facebook/jest/pull/3857)) -* Fix sample code of mock class constructors ([#4115](https://github.com/facebook/jest/pull/4115)) -* Fix setup-test-framework-test ([#3773](https://github.com/facebook/jest/pull/3773)) -* fix typescript jest test crash ([#4363](https://github.com/facebook/jest/pull/4363)) -* Fix watch mode ([#4084](https://github.com/facebook/jest/pull/4084)) -* Fix Watchman on windows ([#4018](https://github.com/facebook/jest/pull/4018)) -* Fix(babel): Handle ignored files in babel v7 ([#4393](https://github.com/facebook/jest/pull/4393)) -* Fix(babel): Support upcoming beta ([#4403](https://github.com/facebook/jest/pull/4403)) -* Fixed object matcher ([#3799](https://github.com/facebook/jest/pull/3799)) -* Fixes #3820 use extractExpectedAssertionsErrors in jasmine setup -* Flow upgrade ([#4355](https://github.com/facebook/jest/pull/4355)) -* Force message in matchers to always be a function ([#3972](https://github.com/facebook/jest/pull/3972)) -* Format `describe` and use `test` instead of `it` alias ([#3792](https://github.com/facebook/jest/pull/3792)) -* global_config.js for multi-project runner ([#4023](https://github.com/facebook/jest/pull/4023)) -* Handle async errors ([#4016](https://github.com/facebook/jest/pull/4016)) -* Hard-fail if hasteImpl is throwing an error during initialization. ([#3812](https://github.com/facebook/jest/pull/3812)) -* Ignore import type for extract_requires ([#4079](https://github.com/facebook/jest/pull/4079)) -* Ignore indentation of data structures in jest-diff ([#3429](https://github.com/facebook/jest/pull/3429)) -* Implement 'jest.requireMock' ([#4292](https://github.com/facebook/jest/pull/4292)) -* Improve Jest phabricator plugin ([#4195](https://github.com/facebook/jest/pull/4195)) -* Improve Seq and remove newline from non-min empty in Immutable plugin ([#4241](https://github.com/facebook/jest/pull/4241)) -* Improved the jest reporter with snapshot info per test. ([#3660](https://github.com/facebook/jest/pull/3660)) -* Include fullName in formattedAssertion ([#4273](https://github.com/facebook/jest/pull/4273)) -* Integrated with Yarn workspaces ([#3906](https://github.com/facebook/jest/pull/3906)) -* jest --all ([#4020](https://github.com/facebook/jest/pull/4020)) -* jest-circus test failures ([#3770](https://github.com/facebook/jest/pull/3770)) -* jest-circus Timeouts ([#3760](https://github.com/facebook/jest/pull/3760)) -* jest-haste-map: add test case for broken handling of ignore pattern ([#4047](https://github.com/facebook/jest/pull/4047)) -* jest-haste-map: add test+fix for broken platform module support ([#3885](https://github.com/facebook/jest/pull/3885)) -* jest-haste-map: deprecate functional ignorePattern and use it in cache key ([#4063](https://github.com/facebook/jest/pull/4063)) -* jest-haste-map: mock 'fs' with more idiomatic jest.mock() ([#4046](https://github.com/facebook/jest/pull/4046)) -* jest-haste-map: only file IO errors should be silently ignored ([#3816](https://github.com/facebook/jest/pull/3816)) -* jest-haste-map: throw when trying to get a duplicated module ([#3976](https://github.com/facebook/jest/pull/3976)) -* jest-haste-map: watchman crawler: normalize paths ([#3887](https://github.com/facebook/jest/pull/3887)) -* jest-runtime: atomic cache write, and check validity of data ([#4088](https://github.com/facebook/jest/pull/4088)) -* Join lines with newline in jest-diff ([#4314](https://github.com/facebook/jest/pull/4314)) -* Keep ARGV only in CLI files ([#4012](https://github.com/facebook/jest/pull/4012)) -* let transformers adjust cache key based on mapCoverage ([#4187](https://github.com/facebook/jest/pull/4187)) -* Lift requires ([#3780](https://github.com/facebook/jest/pull/3780)) -* Log stack when reporting errors in jest-runtime ([#3833](https://github.com/facebook/jest/pull/3833)) -* Make --listTests return a new line separated list when not using --json ([#4229](https://github.com/facebook/jest/pull/4229)) -* Make build script printing small-terminals-friendly ([#3892](https://github.com/facebook/jest/pull/3892)) -* Make error messages more explicit for toBeCalledWith assertions ([#3913](https://github.com/facebook/jest/pull/3913)) -* Make jest-matcher-utils use ESM exports ([#4342](https://github.com/facebook/jest/pull/4342)) -* Make jest-runner a standalone package. ([#4236](https://github.com/facebook/jest/pull/4236)) -* Make Jest’s Test Runner configurable. ([#4240](https://github.com/facebook/jest/pull/4240)) -* Make listTests always print to console.log ([#4391](https://github.com/facebook/jest/pull/4391)) -* Make providesModuleNodeModules ignore nested node_modules directories -* Make sure function mocks match original arity ([#4170](https://github.com/facebook/jest/pull/4170)) -* Make sure runAllTimers also clears all ticks ([#3915](https://github.com/facebook/jest/pull/3915)) -* Make toBe matcher error message more helpful for objects and arrays ([#4277](https://github.com/facebook/jest/pull/4277)) -* Make useRealTimers play well with timers: fake ([#3858](https://github.com/facebook/jest/pull/3858)) -* Move getType from jest-matcher-utils to separate package ([#3559](https://github.com/facebook/jest/pull/3559)) -* Multiroot jest-change-files ([#3969](https://github.com/facebook/jest/pull/3969)) -* Output created snapshot when using --ci option ([#3693](https://github.com/facebook/jest/pull/3693)) -* Point out you can use matchers in .toMatchObject ([#3796](https://github.com/facebook/jest/pull/3796)) -* Prevent babelrc package import failure on relative current path ([#3723](https://github.com/facebook/jest/pull/3723)) -* Print RDP details for windows builds ([#4017](https://github.com/facebook/jest/pull/4017)) -* Provide better error checking for transformed content ([#3807](https://github.com/facebook/jest/pull/3807)) -* Provide printText and printComment in markup.js for HTMLElement plugin ([#4344](https://github.com/facebook/jest/pull/4344)) -* Provide regex visualization for testRegex ([#3758](https://github.com/facebook/jest/pull/3758)) -* Refactor CLI ([#3862](https://github.com/facebook/jest/pull/3862)) -* Refactor names and delimiters of complex values in pretty-format ([#3986](https://github.com/facebook/jest/pull/3986)) -* Replace concat(Immutable) with Immutable as item of plugins array ([#4207](https://github.com/facebook/jest/pull/4207)) -* Replace Jasmine with jest-circus ([#3668](https://github.com/facebook/jest/pull/3668)) -* Replace match with test and omit redundant String conversion ([#4311](https://github.com/facebook/jest/pull/4311)) -* Replace print with serialize in AsymmetricMatcher plugin ([#4173](https://github.com/facebook/jest/pull/4173)) -* Replace print with serialize in ConvertAnsi plugin ([#4225](https://github.com/facebook/jest/pull/4225)) -* Replace print with serialize in HTMLElement plugin ([#4215](https://github.com/facebook/jest/pull/4215)) -* Replace print with serialize in Immutable plugins ([#4189](https://github.com/facebook/jest/pull/4189)) -* Replace unchanging args with one config arg within pretty-format ([#4076](https://github.com/facebook/jest/pull/4076)) -* Return UNDEFINED for undefined type in ReactElement plugin ([#4360](https://github.com/facebook/jest/pull/4360)) -* Rewrite some read bumps in pretty-format ([#4093](https://github.com/facebook/jest/pull/4093)) -* Run update method before installing JRE on Circle ([#4318](https://github.com/facebook/jest/pull/4318)) -* Separated the snapshot summary creation from the printing to improve testability. ([#4373](https://github.com/facebook/jest/pull/4373)) -* Set coverageDirectory during normalize phase ([#3966](https://github.com/facebook/jest/pull/3966)) -* Setup custom reporters after default reporters ([#4053](https://github.com/facebook/jest/pull/4053)) -* Setup for Circle 2 ([#4149](https://github.com/facebook/jest/pull/4149)) -* Simplify readme ([#3790](https://github.com/facebook/jest/pull/3790)) -* Simplify snapshots definition ([#3791](https://github.com/facebook/jest/pull/3791)) -* skipNodeResolution config option ([#3987](https://github.com/facebook/jest/pull/3987)) -* Small fixes to toHaveProperty docs ([#3878](https://github.com/facebook/jest/pull/3878)) -* Sort attributes by name in HTMLElement plugin ([#3783](https://github.com/facebook/jest/pull/3783)) -* Specify watchPathIgnorePatterns will only be available in Jest 21+ ([#4398](https://github.com/facebook/jest/pull/4398)) -* Split TestRunner off of TestScheduler ([#4233](https://github.com/facebook/jest/pull/4233)) -* Strict and explicit config resolution logic ([#4122](https://github.com/facebook/jest/pull/4122)) -* Support maxDepth option in React plugins ([#4208](https://github.com/facebook/jest/pull/4208)) -* Support SVG elements in HTMLElement plugin ([#4335](https://github.com/facebook/jest/pull/4335)) -* Test empty Immutable collections with {min: false} option ([#4121](https://github.com/facebook/jest/pull/4121)) -* test to debug travis failure in master ([#4145](https://github.com/facebook/jest/pull/4145)) -* testPathPattern message test ([#4006](https://github.com/facebook/jest/pull/4006)) -* Throw Error When Using Nested It Specs ([#4039](https://github.com/facebook/jest/pull/4039)) -* Throw when moduleNameMapper points to inexistent module ([#3567](https://github.com/facebook/jest/pull/3567)) -* Unified 'no tests found' message for non-verbose MPR ([#4354](https://github.com/facebook/jest/pull/4354)) -* Update migration guide with jest-codemods transformers ([#4306](https://github.com/facebook/jest/pull/4306)) -* Use "inputSourceMap" for coverage re-mapping. ([#4009](https://github.com/facebook/jest/pull/4009)) -* Use "verbose" no test found message when there is only one project ([#4378](https://github.com/facebook/jest/pull/4378)) -* Use babel transform to inline all requires ([#4340](https://github.com/facebook/jest/pull/4340)) -* Use eslint plugins to run prettier ([#3971](https://github.com/facebook/jest/pull/3971)) -* Use iterableEquality in spy matchers ([#3651](https://github.com/facebook/jest/pull/3651)) -* Use modern HTML5 ([#3937](https://github.com/facebook/jest/pull/3937)) -* Wrap `Error.captureStackTrace` in a try ([#4035](https://github.com/facebook/jest/pull/4035)) +- Fix linting ([#3946](https://github.com/facebook/jest/pull/3946)) +- fix merge conflict ([#4144](https://github.com/facebook/jest/pull/4144)) +- Fix minor typo ([#3729](https://github.com/facebook/jest/pull/3729)) +- fix missing console.log messages ([#3895](https://github.com/facebook/jest/pull/3895)) +- fix mock return value ([#3933](https://github.com/facebook/jest/pull/3933)) +- Fix mocking for modules with folders on windows ([#4238](https://github.com/facebook/jest/pull/4238)) +- Fix NODE_PATH resolving for relative paths ([#3616](https://github.com/facebook/jest/pull/3616)) +- Fix options.moduleNameMapper override order with preset ([#3565](https://github.com/facebook/jest/pull/3565) ([#3689](https://github.com/facebook/jest/pull/3689)) +- Fix React PropTypes warning in tests for Immutable plugin ([#4412](https://github.com/facebook/jest/pull/4412)) +- Fix regression in mockReturnValueOnce ([#3857](https://github.com/facebook/jest/pull/3857)) +- Fix sample code of mock class constructors ([#4115](https://github.com/facebook/jest/pull/4115)) +- Fix setup-test-framework-test ([#3773](https://github.com/facebook/jest/pull/3773)) +- fix typescript jest test crash ([#4363](https://github.com/facebook/jest/pull/4363)) +- Fix watch mode ([#4084](https://github.com/facebook/jest/pull/4084)) +- Fix Watchman on windows ([#4018](https://github.com/facebook/jest/pull/4018)) +- Fix(babel): Handle ignored files in babel v7 ([#4393](https://github.com/facebook/jest/pull/4393)) +- Fix(babel): Support upcoming beta ([#4403](https://github.com/facebook/jest/pull/4403)) +- Fixed object matcher ([#3799](https://github.com/facebook/jest/pull/3799)) +- Fixes #3820 use extractExpectedAssertionsErrors in jasmine setup +- Flow upgrade ([#4355](https://github.com/facebook/jest/pull/4355)) +- Force message in matchers to always be a function ([#3972](https://github.com/facebook/jest/pull/3972)) +- Format `describe` and use `test` instead of `it` alias ([#3792](https://github.com/facebook/jest/pull/3792)) +- global_config.js for multi-project runner ([#4023](https://github.com/facebook/jest/pull/4023)) +- Handle async errors ([#4016](https://github.com/facebook/jest/pull/4016)) +- Hard-fail if hasteImpl is throwing an error during initialization. ([#3812](https://github.com/facebook/jest/pull/3812)) +- Ignore import type for extract_requires ([#4079](https://github.com/facebook/jest/pull/4079)) +- Ignore indentation of data structures in jest-diff ([#3429](https://github.com/facebook/jest/pull/3429)) +- Implement 'jest.requireMock' ([#4292](https://github.com/facebook/jest/pull/4292)) +- Improve Jest phabricator plugin ([#4195](https://github.com/facebook/jest/pull/4195)) +- Improve Seq and remove newline from non-min empty in Immutable plugin ([#4241](https://github.com/facebook/jest/pull/4241)) +- Improved the jest reporter with snapshot info per test. ([#3660](https://github.com/facebook/jest/pull/3660)) +- Include fullName in formattedAssertion ([#4273](https://github.com/facebook/jest/pull/4273)) +- Integrated with Yarn workspaces ([#3906](https://github.com/facebook/jest/pull/3906)) +- jest --all ([#4020](https://github.com/facebook/jest/pull/4020)) +- jest-circus test failures ([#3770](https://github.com/facebook/jest/pull/3770)) +- jest-circus Timeouts ([#3760](https://github.com/facebook/jest/pull/3760)) +- jest-haste-map: add test case for broken handling of ignore pattern ([#4047](https://github.com/facebook/jest/pull/4047)) +- jest-haste-map: add test+fix for broken platform module support ([#3885](https://github.com/facebook/jest/pull/3885)) +- jest-haste-map: deprecate functional ignorePattern and use it in cache key ([#4063](https://github.com/facebook/jest/pull/4063)) +- jest-haste-map: mock 'fs' with more idiomatic jest.mock() ([#4046](https://github.com/facebook/jest/pull/4046)) +- jest-haste-map: only file IO errors should be silently ignored ([#3816](https://github.com/facebook/jest/pull/3816)) +- jest-haste-map: throw when trying to get a duplicated module ([#3976](https://github.com/facebook/jest/pull/3976)) +- jest-haste-map: watchman crawler: normalize paths ([#3887](https://github.com/facebook/jest/pull/3887)) +- jest-runtime: atomic cache write, and check validity of data ([#4088](https://github.com/facebook/jest/pull/4088)) +- Join lines with newline in jest-diff ([#4314](https://github.com/facebook/jest/pull/4314)) +- Keep ARGV only in CLI files ([#4012](https://github.com/facebook/jest/pull/4012)) +- let transformers adjust cache key based on mapCoverage ([#4187](https://github.com/facebook/jest/pull/4187)) +- Lift requires ([#3780](https://github.com/facebook/jest/pull/3780)) +- Log stack when reporting errors in jest-runtime ([#3833](https://github.com/facebook/jest/pull/3833)) +- Make --listTests return a new line separated list when not using --json ([#4229](https://github.com/facebook/jest/pull/4229)) +- Make build script printing small-terminals-friendly ([#3892](https://github.com/facebook/jest/pull/3892)) +- Make error messages more explicit for toBeCalledWith assertions ([#3913](https://github.com/facebook/jest/pull/3913)) +- Make jest-matcher-utils use ESM exports ([#4342](https://github.com/facebook/jest/pull/4342)) +- Make jest-runner a standalone package. ([#4236](https://github.com/facebook/jest/pull/4236)) +- Make Jest’s Test Runner configurable. ([#4240](https://github.com/facebook/jest/pull/4240)) +- Make listTests always print to console.log ([#4391](https://github.com/facebook/jest/pull/4391)) +- Make providesModuleNodeModules ignore nested node_modules directories +- Make sure function mocks match original arity ([#4170](https://github.com/facebook/jest/pull/4170)) +- Make sure runAllTimers also clears all ticks ([#3915](https://github.com/facebook/jest/pull/3915)) +- Make toBe matcher error message more helpful for objects and arrays ([#4277](https://github.com/facebook/jest/pull/4277)) +- Make useRealTimers play well with timers: fake ([#3858](https://github.com/facebook/jest/pull/3858)) +- Move getType from jest-matcher-utils to separate package ([#3559](https://github.com/facebook/jest/pull/3559)) +- Multiroot jest-change-files ([#3969](https://github.com/facebook/jest/pull/3969)) +- Output created snapshot when using --ci option ([#3693](https://github.com/facebook/jest/pull/3693)) +- Point out you can use matchers in .toMatchObject ([#3796](https://github.com/facebook/jest/pull/3796)) +- Prevent babelrc package import failure on relative current path ([#3723](https://github.com/facebook/jest/pull/3723)) +- Print RDP details for windows builds ([#4017](https://github.com/facebook/jest/pull/4017)) +- Provide better error checking for transformed content ([#3807](https://github.com/facebook/jest/pull/3807)) +- Provide printText and printComment in markup.js for HTMLElement plugin ([#4344](https://github.com/facebook/jest/pull/4344)) +- Provide regex visualization for testRegex ([#3758](https://github.com/facebook/jest/pull/3758)) +- Refactor CLI ([#3862](https://github.com/facebook/jest/pull/3862)) +- Refactor names and delimiters of complex values in pretty-format ([#3986](https://github.com/facebook/jest/pull/3986)) +- Replace concat(Immutable) with Immutable as item of plugins array ([#4207](https://github.com/facebook/jest/pull/4207)) +- Replace Jasmine with jest-circus ([#3668](https://github.com/facebook/jest/pull/3668)) +- Replace match with test and omit redundant String conversion ([#4311](https://github.com/facebook/jest/pull/4311)) +- Replace print with serialize in AsymmetricMatcher plugin ([#4173](https://github.com/facebook/jest/pull/4173)) +- Replace print with serialize in ConvertAnsi plugin ([#4225](https://github.com/facebook/jest/pull/4225)) +- Replace print with serialize in HTMLElement plugin ([#4215](https://github.com/facebook/jest/pull/4215)) +- Replace print with serialize in Immutable plugins ([#4189](https://github.com/facebook/jest/pull/4189)) +- Replace unchanging args with one config arg within pretty-format ([#4076](https://github.com/facebook/jest/pull/4076)) +- Return UNDEFINED for undefined type in ReactElement plugin ([#4360](https://github.com/facebook/jest/pull/4360)) +- Rewrite some read bumps in pretty-format ([#4093](https://github.com/facebook/jest/pull/4093)) +- Run update method before installing JRE on Circle ([#4318](https://github.com/facebook/jest/pull/4318)) +- Separated the snapshot summary creation from the printing to improve testability. ([#4373](https://github.com/facebook/jest/pull/4373)) +- Set coverageDirectory during normalize phase ([#3966](https://github.com/facebook/jest/pull/3966)) +- Setup custom reporters after default reporters ([#4053](https://github.com/facebook/jest/pull/4053)) +- Setup for Circle 2 ([#4149](https://github.com/facebook/jest/pull/4149)) +- Simplify readme ([#3790](https://github.com/facebook/jest/pull/3790)) +- Simplify snapshots definition ([#3791](https://github.com/facebook/jest/pull/3791)) +- skipNodeResolution config option ([#3987](https://github.com/facebook/jest/pull/3987)) +- Small fixes to toHaveProperty docs ([#3878](https://github.com/facebook/jest/pull/3878)) +- Sort attributes by name in HTMLElement plugin ([#3783](https://github.com/facebook/jest/pull/3783)) +- Specify watchPathIgnorePatterns will only be available in Jest 21+ ([#4398](https://github.com/facebook/jest/pull/4398)) +- Split TestRunner off of TestScheduler ([#4233](https://github.com/facebook/jest/pull/4233)) +- Strict and explicit config resolution logic ([#4122](https://github.com/facebook/jest/pull/4122)) +- Support maxDepth option in React plugins ([#4208](https://github.com/facebook/jest/pull/4208)) +- Support SVG elements in HTMLElement plugin ([#4335](https://github.com/facebook/jest/pull/4335)) +- Test empty Immutable collections with {min: false} option ([#4121](https://github.com/facebook/jest/pull/4121)) +- test to debug travis failure in master ([#4145](https://github.com/facebook/jest/pull/4145)) +- testPathPattern message test ([#4006](https://github.com/facebook/jest/pull/4006)) +- Throw Error When Using Nested It Specs ([#4039](https://github.com/facebook/jest/pull/4039)) +- Throw when moduleNameMapper points to inexistent module ([#3567](https://github.com/facebook/jest/pull/3567)) +- Unified 'no tests found' message for non-verbose MPR ([#4354](https://github.com/facebook/jest/pull/4354)) +- Update migration guide with jest-codemods transformers ([#4306](https://github.com/facebook/jest/pull/4306)) +- Use "inputSourceMap" for coverage re-mapping. ([#4009](https://github.com/facebook/jest/pull/4009)) +- Use "verbose" no test found message when there is only one project ([#4378](https://github.com/facebook/jest/pull/4378)) +- Use babel transform to inline all requires ([#4340](https://github.com/facebook/jest/pull/4340)) +- Use eslint plugins to run prettier ([#3971](https://github.com/facebook/jest/pull/3971)) +- Use iterableEquality in spy matchers ([#3651](https://github.com/facebook/jest/pull/3651)) +- Use modern HTML5 ([#3937](https://github.com/facebook/jest/pull/3937)) +- Wrap `Error.captureStackTrace` in a try ([#4035](https://github.com/facebook/jest/pull/4035)) ## jest 20.0.4 -* Fix jest-haste-map's handling of duplicate module IDs. ([#3647](https://github.com/facebook/jest/pull/3647)) -* Fix behavior of `enableAutomock()` when automock is set to false. ([#3624](https://github.com/facebook/jest/pull/3624)) -* Fix progress bar in windows. ([#3626](https://github.com/facebook/jest/pull/3626)) +- Fix jest-haste-map's handling of duplicate module IDs. ([#3647](https://github.com/facebook/jest/pull/3647)) +- Fix behavior of `enableAutomock()` when automock is set to false. ([#3624](https://github.com/facebook/jest/pull/3624)) +- Fix progress bar in windows. ([#3626](https://github.com/facebook/jest/pull/3626)) ## jest 20.0.3 -* Fix reporters 'default' setting. ([#3562](https://github.com/facebook/jest/pull/3562)) -* Fix to make Jest fail when the coverage threshold not met. ([#3554](https://github.com/facebook/jest/pull/3554)) +- Fix reporters 'default' setting. ([#3562](https://github.com/facebook/jest/pull/3562)) +- Fix to make Jest fail when the coverage threshold not met. ([#3554](https://github.com/facebook/jest/pull/3554)) ## jest 20.0.1 -* Add ansi-regex to pretty-format dependencies ([#3498](https://github.com/facebook/jest/pull/3498)) -* Fix replacement in testMatch and moduleDirectories ([#3538](https://github.com/facebook/jest/pull/3538)) -* Fix expect.hasAssertions() to throw when passed arguments ([#3526](https://github.com/facebook/jest/pull/3526)) -* Fix stack traces without proper error messages ([#3513](https://github.com/facebook/jest/pull/3513)) -* Fix support for custom extensions through haste packages ([#3537](https://github.com/facebook/jest/pull/3537)) -* Fix test contexts between test functions ([#3506](https://github.com/facebook/jest/pull/3506)) +- Add ansi-regex to pretty-format dependencies ([#3498](https://github.com/facebook/jest/pull/3498)) +- Fix replacement in testMatch and moduleDirectories ([#3538](https://github.com/facebook/jest/pull/3538)) +- Fix expect.hasAssertions() to throw when passed arguments ([#3526](https://github.com/facebook/jest/pull/3526)) +- Fix stack traces without proper error messages ([#3513](https://github.com/facebook/jest/pull/3513)) +- Fix support for custom extensions through haste packages ([#3537](https://github.com/facebook/jest/pull/3537)) +- Fix test contexts between test functions ([#3506](https://github.com/facebook/jest/pull/3506)) ## jest 20.0.0 -* New `--projects` option to run one instance of Jest in multiple projects at the same time. ([#3400](https://github.com/facebook/jest/pull/3400)) -* New multi project runner ([#3156](https://github.com/facebook/jest/pull/3156)) -* New --listTests flag. ([#3441](https://github.com/facebook/jest/pull/3441)) -* New --showConfig flag. ([#3296](https://github.com/facebook/jest/pull/3296)) -* New promise support for all `expect` matchers through `.resolves` and `.rejects`. ([#3068](https://github.com/facebook/jest/pull/3068)) -* New `expect.hasAssertions()` function similar to `expect.assertions()`. ([#3379](https://github.com/facebook/jest/pull/3379)) -* New `this.equals` function exposed to custom matchers. ([#3469](https://github.com/facebook/jest/pull/3469)) -* New `valid-expect` lint rule in `eslint-plugin-jest`. ([#3067](https://github.com/facebook/jest/pull/3067)) -* New HtmlElement pretty-format plugin. ([#3230](https://github.com/facebook/jest/pull/3230)) -* New Immutable pretty-format plugins. ([#2899](https://github.com/facebook/jest/pull/2899)) -* New test environment per file setting through `@jest-environment` in the docblock. ([#2859](https://github.com/facebook/jest/pull/2859)) -* New feature that allows every configuration option to be set from the command line. ([#3424](https://github.com/facebook/jest/pull/3424)) -* New feature to add custom reporters to Jest through `reporters` in the configuration. ([#3349](https://github.com/facebook/jest/pull/3349)) -* New feature to add expected and actual values to AssertionError. ([#3217](https://github.com/facebook/jest/pull/3217)) -* New feature to map code coverage from transformers. ([#2290](https://github.com/facebook/jest/pull/2290)) -* New feature to run untested code coverage in parallel. ([#3407](https://github.com/facebook/jest/pull/3407)) -* New option to define a custom resolver. ([#2998](https://github.com/facebook/jest/pull/2998)) -* New printing support for text and comment nodes in html pretty-format. ([#3355](https://github.com/facebook/jest/pull/3355)) -* New snapshot testing FAQ ([#3425](https://github.com/facebook/jest/pull/3425)) -* New support for custom platforms on jest-haste-map. ([#3162](https://github.com/facebook/jest/pull/3162)) -* New support for mocking native async methods. ([#3209](https://github.com/facebook/jest/pull/3209)) -* New guide on how to use Jest with any JavaScript framework. ([#3243](https://github.com/facebook/jest/pull/3243)) -* New translation system for the Jest website. -* New collapsing watch mode usage prompt after first run. ([#3078](https://github.com/facebook/jest/pull/3078)) -* Breaking Change: Forked Jasmine 2.5 into Jest's own test runner and rewrote large parts of Jasmine. ([#3147](https://github.com/facebook/jest/pull/3147)) -* Breaking Change: Jest does not write new snapshots by default on CI. ([#3456](https://github.com/facebook/jest/pull/3456)) -* Breaking Change: Moved the typescript parser from `jest-editor-support` into a separate `jest-test-typescript-parser` package. ([#2973](https://github.com/facebook/jest/pull/2973)) -* Breaking Change: Replaced auto-loading of babel-polyfill with only regenerator-runtime, fixes a major memory leak. ([#2755](https://github.com/facebook/jest/pull/2755)) -* Fixed `babel-jest` to look up the `babel` field in `package.json` as a fallback. -* Fixed `jest-editor-support`'s parser to not crash on incomplete ASTs. ([#3259](https://github.com/facebook/jest/pull/3259)) -* Fixed `jest-resolve` to use `is-builtin-module` instead of `resolve.isCore`. ([#2997](https://github.com/facebook/jest/pull/2997)) -* Fixed `jest-snapshot` to normalize line endings in the `serialize` function. ([#3002](https://github.com/facebook/jest/pull/3002)) -* Fixed behavior of `--silent` flag. ([#3003](https://github.com/facebook/jest/pull/3003)) -* Fixed bug with watchers on macOS causing test to crash. ([#2957](https://github.com/facebook/jest/pull/2957)) -* Fixed CLI `notify` option not taking precedence over config option. ([#3340](https://github.com/facebook/jest/pull/3340)) -* Fixed detection of the npm client in SummaryReporter to support Yarn. ([#3263](https://github.com/facebook/jest/pull/3263)) -* Fixed done.fail not passing arguments ([#3241](https://github.com/facebook/jest/pull/3241)) -* Fixed fake timers to restore after resetting mocks. ([#2467](https://github.com/facebook/jest/pull/2467)) -* Fixed handling of babylon's parser options in `jest-editor-support`. ([#3344](https://github.com/facebook/jest/pull/3344)) -* Fixed Jest to properly cache transform results. ([#3334](https://github.com/facebook/jest/pull/3334)) -* Fixed Jest to use human-readable colors for Jest's own snapshots. ([#3119](https://github.com/facebook/jest/pull/3119)) -* Fixed jest-config to use UID for default cache folder. ([#3380](https://github.com/facebook/jest/pull/3380)), ([#3387](https://github.com/facebook/jest/pull/3387)) -* Fixed jest-runtime to expose inner error when it fails to write to the cache. ([#3373](https://github.com/facebook/jest/pull/3373)) -* Fixed lifecycle hooks to make afterAll hooks operate the same as afterEach. ([#3275](https://github.com/facebook/jest/pull/3275)) -* Fixed pretty-format to run plugins before serializing nested basic values. ([#3017](https://github.com/facebook/jest/pull/3017)) -* Fixed return value of mocks so they can explicitly be set to return `undefined`. ([#3354](https://github.com/facebook/jest/pull/3354)) -* Fixed runner to run tests associated with snapshots when the snapshot changes. ([#3025](https://github.com/facebook/jest/pull/3025)) -* Fixed snapshot serializer require, restructured pretty-format. ([#3399](https://github.com/facebook/jest/pull/3399)) -* Fixed support for Babel 7 in babel-jest. ([#3271](https://github.com/facebook/jest/pull/3271)) -* Fixed testMatch to find tests in .folders. ([#3006](https://github.com/facebook/jest/pull/3006)) -* Fixed testNamePattern and testPathPattern to work better together. ([#3327](https://github.com/facebook/jest/pull/3327)) -* Fixed to show reject reason when expecting resolve. ([#3134](https://github.com/facebook/jest/pull/3134)) -* Fixed toHaveProperty() to use hasOwnProperty from Object ([#3410](https://github.com/facebook/jest/pull/3410)) -* Fixed watch mode's screen clearing. ([#2959](https://github.com/facebook/jest/pull/2959)) ([#3294](https://github.com/facebook/jest/pull/3294)) -* Improved and consolidated Jest's configuration file resolution. ([#3472](https://github.com/facebook/jest/pull/3472)) -* Improved documentation throughout the Jest website. -* Improved documentation to explicitly mention that snapshots must be reviewed. ([#3203](https://github.com/facebook/jest/pull/3203)) -* Improved documentation to make it clear CRA users don't need to add dependencies. ([#3312](https://github.com/facebook/jest/pull/3312)) -* Improved eslint-plugin-jest's handling of `expect`. ([#3306](https://github.com/facebook/jest/pull/3306)) -* Improved flow-coverage, eslint rules and test coverage within the Jest repository. -* Improved printing of `expect.assertions` error. ([#3033](https://github.com/facebook/jest/pull/3033)) -* Improved Windows test coverage of Jest. -* Refactored configs & transform ([#3376](https://github.com/facebook/jest/pull/3376)) -* Refactored reporters to pass individual Tests to reporters. ([#3289](https://github.com/facebook/jest/pull/3289)) -* Refactored TestRunner ([#3166](https://github.com/facebook/jest/pull/3166)) -* Refactored watch mode prompts. ([#3290](https://github.com/facebook/jest/pull/3290)) -* Deleted `jest-file-exists`. ([#3105](https://github.com/facebook/jest/pull/3105)) -* Removed `Config` type. ([#3366](https://github.com/facebook/jest/pull/3366)) -* Removed all usage of `jest-file-exists`. ([#3101](https://github.com/facebook/jest/pull/3101)) -* Adopted prettier on the Jest codebase. +- New `--projects` option to run one instance of Jest in multiple projects at the same time. ([#3400](https://github.com/facebook/jest/pull/3400)) +- New multi project runner ([#3156](https://github.com/facebook/jest/pull/3156)) +- New --listTests flag. ([#3441](https://github.com/facebook/jest/pull/3441)) +- New --showConfig flag. ([#3296](https://github.com/facebook/jest/pull/3296)) +- New promise support for all `expect` matchers through `.resolves` and `.rejects`. ([#3068](https://github.com/facebook/jest/pull/3068)) +- New `expect.hasAssertions()` function similar to `expect.assertions()`. ([#3379](https://github.com/facebook/jest/pull/3379)) +- New `this.equals` function exposed to custom matchers. ([#3469](https://github.com/facebook/jest/pull/3469)) +- New `valid-expect` lint rule in `eslint-plugin-jest`. ([#3067](https://github.com/facebook/jest/pull/3067)) +- New HtmlElement pretty-format plugin. ([#3230](https://github.com/facebook/jest/pull/3230)) +- New Immutable pretty-format plugins. ([#2899](https://github.com/facebook/jest/pull/2899)) +- New test environment per file setting through `@jest-environment` in the docblock. ([#2859](https://github.com/facebook/jest/pull/2859)) +- New feature that allows every configuration option to be set from the command line. ([#3424](https://github.com/facebook/jest/pull/3424)) +- New feature to add custom reporters to Jest through `reporters` in the configuration. ([#3349](https://github.com/facebook/jest/pull/3349)) +- New feature to add expected and actual values to AssertionError. ([#3217](https://github.com/facebook/jest/pull/3217)) +- New feature to map code coverage from transformers. ([#2290](https://github.com/facebook/jest/pull/2290)) +- New feature to run untested code coverage in parallel. ([#3407](https://github.com/facebook/jest/pull/3407)) +- New option to define a custom resolver. ([#2998](https://github.com/facebook/jest/pull/2998)) +- New printing support for text and comment nodes in html pretty-format. ([#3355](https://github.com/facebook/jest/pull/3355)) +- New snapshot testing FAQ ([#3425](https://github.com/facebook/jest/pull/3425)) +- New support for custom platforms on jest-haste-map. ([#3162](https://github.com/facebook/jest/pull/3162)) +- New support for mocking native async methods. ([#3209](https://github.com/facebook/jest/pull/3209)) +- New guide on how to use Jest with any JavaScript framework. ([#3243](https://github.com/facebook/jest/pull/3243)) +- New translation system for the Jest website. +- New collapsing watch mode usage prompt after first run. ([#3078](https://github.com/facebook/jest/pull/3078)) +- Breaking Change: Forked Jasmine 2.5 into Jest's own test runner and rewrote large parts of Jasmine. ([#3147](https://github.com/facebook/jest/pull/3147)) +- Breaking Change: Jest does not write new snapshots by default on CI. ([#3456](https://github.com/facebook/jest/pull/3456)) +- Breaking Change: Moved the typescript parser from `jest-editor-support` into a separate `jest-test-typescript-parser` package. ([#2973](https://github.com/facebook/jest/pull/2973)) +- Breaking Change: Replaced auto-loading of babel-polyfill with only regenerator-runtime, fixes a major memory leak. ([#2755](https://github.com/facebook/jest/pull/2755)) +- Fixed `babel-jest` to look up the `babel` field in `package.json` as a fallback. +- Fixed `jest-editor-support`'s parser to not crash on incomplete ASTs. ([#3259](https://github.com/facebook/jest/pull/3259)) +- Fixed `jest-resolve` to use `is-builtin-module` instead of `resolve.isCore`. ([#2997](https://github.com/facebook/jest/pull/2997)) +- Fixed `jest-snapshot` to normalize line endings in the `serialize` function. ([#3002](https://github.com/facebook/jest/pull/3002)) +- Fixed behavior of `--silent` flag. ([#3003](https://github.com/facebook/jest/pull/3003)) +- Fixed bug with watchers on macOS causing test to crash. ([#2957](https://github.com/facebook/jest/pull/2957)) +- Fixed CLI `notify` option not taking precedence over config option. ([#3340](https://github.com/facebook/jest/pull/3340)) +- Fixed detection of the npm client in SummaryReporter to support Yarn. ([#3263](https://github.com/facebook/jest/pull/3263)) +- Fixed done.fail not passing arguments ([#3241](https://github.com/facebook/jest/pull/3241)) +- Fixed fake timers to restore after resetting mocks. ([#2467](https://github.com/facebook/jest/pull/2467)) +- Fixed handling of babylon's parser options in `jest-editor-support`. ([#3344](https://github.com/facebook/jest/pull/3344)) +- Fixed Jest to properly cache transform results. ([#3334](https://github.com/facebook/jest/pull/3334)) +- Fixed Jest to use human-readable colors for Jest's own snapshots. ([#3119](https://github.com/facebook/jest/pull/3119)) +- Fixed jest-config to use UID for default cache folder. ([#3380](https://github.com/facebook/jest/pull/3380)), ([#3387](https://github.com/facebook/jest/pull/3387)) +- Fixed jest-runtime to expose inner error when it fails to write to the cache. ([#3373](https://github.com/facebook/jest/pull/3373)) +- Fixed lifecycle hooks to make afterAll hooks operate the same as afterEach. ([#3275](https://github.com/facebook/jest/pull/3275)) +- Fixed pretty-format to run plugins before serializing nested basic values. ([#3017](https://github.com/facebook/jest/pull/3017)) +- Fixed return value of mocks so they can explicitly be set to return `undefined`. ([#3354](https://github.com/facebook/jest/pull/3354)) +- Fixed runner to run tests associated with snapshots when the snapshot changes. ([#3025](https://github.com/facebook/jest/pull/3025)) +- Fixed snapshot serializer require, restructured pretty-format. ([#3399](https://github.com/facebook/jest/pull/3399)) +- Fixed support for Babel 7 in babel-jest. ([#3271](https://github.com/facebook/jest/pull/3271)) +- Fixed testMatch to find tests in .folders. ([#3006](https://github.com/facebook/jest/pull/3006)) +- Fixed testNamePattern and testPathPattern to work better together. ([#3327](https://github.com/facebook/jest/pull/3327)) +- Fixed to show reject reason when expecting resolve. ([#3134](https://github.com/facebook/jest/pull/3134)) +- Fixed toHaveProperty() to use hasOwnProperty from Object ([#3410](https://github.com/facebook/jest/pull/3410)) +- Fixed watch mode's screen clearing. ([#2959](https://github.com/facebook/jest/pull/2959)) ([#3294](https://github.com/facebook/jest/pull/3294)) +- Improved and consolidated Jest's configuration file resolution. ([#3472](https://github.com/facebook/jest/pull/3472)) +- Improved documentation throughout the Jest website. +- Improved documentation to explicitly mention that snapshots must be reviewed. ([#3203](https://github.com/facebook/jest/pull/3203)) +- Improved documentation to make it clear CRA users don't need to add dependencies. ([#3312](https://github.com/facebook/jest/pull/3312)) +- Improved eslint-plugin-jest's handling of `expect`. ([#3306](https://github.com/facebook/jest/pull/3306)) +- Improved flow-coverage, eslint rules and test coverage within the Jest repository. +- Improved printing of `expect.assertions` error. ([#3033](https://github.com/facebook/jest/pull/3033)) +- Improved Windows test coverage of Jest. +- Refactored configs & transform ([#3376](https://github.com/facebook/jest/pull/3376)) +- Refactored reporters to pass individual Tests to reporters. ([#3289](https://github.com/facebook/jest/pull/3289)) +- Refactored TestRunner ([#3166](https://github.com/facebook/jest/pull/3166)) +- Refactored watch mode prompts. ([#3290](https://github.com/facebook/jest/pull/3290)) +- Deleted `jest-file-exists`. ([#3105](https://github.com/facebook/jest/pull/3105)) +- Removed `Config` type. ([#3366](https://github.com/facebook/jest/pull/3366)) +- Removed all usage of `jest-file-exists`. ([#3101](https://github.com/facebook/jest/pull/3101)) +- Adopted prettier on the Jest codebase. ## jest 19.0.1 -* Fix infinite loop when using `--watch` with `--coverage`. -* Fixed `watchman` config option. -* Fixed a bug in the jest-editor-support static analysis. -* Fixed eslint plugin warning. -* Fixed missing space in front of "Did you mean …?". -* Fixed path printing in the reporter on Windows. +- Fix infinite loop when using `--watch` with `--coverage`. +- Fixed `watchman` config option. +- Fixed a bug in the jest-editor-support static analysis. +- Fixed eslint plugin warning. +- Fixed missing space in front of "Did you mean …?". +- Fixed path printing in the reporter on Windows. ## jest 19.0.0 -* Breaking Change: Added a version for snapshots. -* Breaking Change: Removed the `mocksPattern` configuration option, it never worked correctly. -* Breaking Change: Renamed `testPathDirs` to `roots` to avoid confusion when configuring Jest. -* Breaking Change: Updated printing of React elements to cause fewer changes when props change. -* Breaking Change: Updated snapshot format to properly escape data. -* Fixed --color to be recognized correctly again. -* Fixed `babel-plugin-jest-hoist` to work properly with type annotations in tests. -* Fixed behavior for console.log calls and fixed a memory leak (#2539). -* Fixed cache directory path for Jest to avoid ENAMETOOLONG errors. -* Fixed change events to be emitted in jest-haste-map's watch mode. This fixes issues with Jest's new watch mode and react-native-packager. -* Fixed cli arguments to be used when loading the config from file, they were previously ignored. -* Fixed Jest to load json files that include a BOM. -* Fixed Jest to throw errors instead of ignoring invalid cli options. -* Fixed mocking behavior for virtual modules. -* Fixed mocking behavior with transitive dependencies. -* Fixed support for asymmetric matchers in `toMatchObject`. -* Fixed test interruption and `--bail` behavior. -* Fixed watch mode to clean up worker processes when a test run gets interrupted. -* Fixed whitespace to be highlighted in snapshots and assertion errors. -* Improved `babel-jest` plugin: babel is loaded lazily, istanbul comments are only added when coverage is used. -* Improved error for invalid transform config. -* Improved moduleNameMapper to not overwrite mocks when many patterns map to the same file. -* Improved printing of skipped tests in verbose mode. -* Improved resolution code in jest-resolve. -* Improved to only show patch marks in assertion errors when the comparison results in large objects. -* New `--collectCoverageFrom` cli argument. -* New `--coverageDirectory` cli argument. -* New `expect.addSnapshotSerializer` to add custom snapshot serializers for tests. -* New `jest.spyOn`. -* New `testMatch` configuration option that accepts glob patterns. -* New eslint-plugin-jest with no-disabled-tests, no-focuses-tests and no-identical-title rules and default configuration and globals. -* New expect.stringContaining asymmetric matcher. -* New feature to make manual mocks with nested folders work. For example `__mocks__/react-native/Library/Text.js` will now work as expected. -* New feature to re-run tests through the notification when using `--notify`. -* New jest-phabricator package to integrate Jest code coverage in phabriactor. -* New jest-validate package to improve configuration errors, help with suggestions of correct configuration and to be adopted in other libraries. -* New pretty-printing for asymmetric matchers. -* New RSS feed for Jest's blog. -* New way to provide a reducer to extract haste module ids. -* New website, new documentation, new color scheme and new homepage. -* Rewritten watch mode for instant feedback, better code quality and to build new features on top of it (#2362). +- Breaking Change: Added a version for snapshots. +- Breaking Change: Removed the `mocksPattern` configuration option, it never worked correctly. +- Breaking Change: Renamed `testPathDirs` to `roots` to avoid confusion when configuring Jest. +- Breaking Change: Updated printing of React elements to cause fewer changes when props change. +- Breaking Change: Updated snapshot format to properly escape data. +- Fixed --color to be recognized correctly again. +- Fixed `babel-plugin-jest-hoist` to work properly with type annotations in tests. +- Fixed behavior for console.log calls and fixed a memory leak (#2539). +- Fixed cache directory path for Jest to avoid ENAMETOOLONG errors. +- Fixed change events to be emitted in jest-haste-map's watch mode. This fixes issues with Jest's new watch mode and react-native-packager. +- Fixed cli arguments to be used when loading the config from file, they were previously ignored. +- Fixed Jest to load json files that include a BOM. +- Fixed Jest to throw errors instead of ignoring invalid cli options. +- Fixed mocking behavior for virtual modules. +- Fixed mocking behavior with transitive dependencies. +- Fixed support for asymmetric matchers in `toMatchObject`. +- Fixed test interruption and `--bail` behavior. +- Fixed watch mode to clean up worker processes when a test run gets interrupted. +- Fixed whitespace to be highlighted in snapshots and assertion errors. +- Improved `babel-jest` plugin: babel is loaded lazily, istanbul comments are only added when coverage is used. +- Improved error for invalid transform config. +- Improved moduleNameMapper to not overwrite mocks when many patterns map to the same file. +- Improved printing of skipped tests in verbose mode. +- Improved resolution code in jest-resolve. +- Improved to only show patch marks in assertion errors when the comparison results in large objects. +- New `--collectCoverageFrom` cli argument. +- New `--coverageDirectory` cli argument. +- New `expect.addSnapshotSerializer` to add custom snapshot serializers for tests. +- New `jest.spyOn`. +- New `testMatch` configuration option that accepts glob patterns. +- New eslint-plugin-jest with no-disabled-tests, no-focuses-tests and no-identical-title rules and default configuration and globals. +- New expect.stringContaining asymmetric matcher. +- New feature to make manual mocks with nested folders work. For example `__mocks__/react-native/Library/Text.js` will now work as expected. +- New feature to re-run tests through the notification when using `--notify`. +- New jest-phabricator package to integrate Jest code coverage in phabriactor. +- New jest-validate package to improve configuration errors, help with suggestions of correct configuration and to be adopted in other libraries. +- New pretty-printing for asymmetric matchers. +- New RSS feed for Jest's blog. +- New way to provide a reducer to extract haste module ids. +- New website, new documentation, new color scheme and new homepage. +- Rewritten watch mode for instant feedback, better code quality and to build new features on top of it (#2362). ## jest 18.1.0 -* Fixed console.log and fake timer behavior in node 7.3. -* Updated istanbul-api. -* Updated jest-diff equality error message. -* Disabled arrow keys when entering a pattern in watch mode to prevent broken behavior. Will be improved in a future release. -* Moved asymmetric matchers and equality functionality from Jasmine into jest-matchers. -* Removed jasmine and jest-snapshot dependency from jest-matchers. -* Removed unused global `context` variable. -* Show a better error message if the config is invalid JSON. -* Highlight trailing whitespace in assertion diffs and snapshots. -* Jest now uses micromatch instead of minimatch. -* Added `-h` as alias for `--help`. +- Fixed console.log and fake timer behavior in node 7.3. +- Updated istanbul-api. +- Updated jest-diff equality error message. +- Disabled arrow keys when entering a pattern in watch mode to prevent broken behavior. Will be improved in a future release. +- Moved asymmetric matchers and equality functionality from Jasmine into jest-matchers. +- Removed jasmine and jest-snapshot dependency from jest-matchers. +- Removed unused global `context` variable. +- Show a better error message if the config is invalid JSON. +- Highlight trailing whitespace in assertion diffs and snapshots. +- Jest now uses micromatch instead of minimatch. +- Added `-h` as alias for `--help`. ## jest 18.0.0 See https://facebook.github.io/jest/blog/2016/12/15/2016-in-jest.html -* The testResultsProcessor function is now required to return the modified results. -* Removed `pit` and `mockImpl`. Use `it` or `mockImplementation` instead. -* Fixed re-running tests when `--bail` is used together with `--watch`. -* `pretty-format` is now merged into Jest. -* `require('v8')` now works properly in a test context. -* Jest now clears the entire scrollback in watch mode. -* Added `expect.any`, `expect.anything`, `expect.objectContaining`, `expect.arrayContaining`, `expect.stringMatching`. -* Properly resolve `snapshotSerializers`, `setupFiles`, `transform`, `testRunner` and `testResultsProcessor` instead of using `path.resolve`. -* `--testResultsProcessor` is now exposed through the cli. -* Renamed `--jsonOutputFile` to `--outputFile`. -* Added `jest-editor-support` for vscode and Nuclide integration. -* Fixed `test.concurrent` unhandled promise rejections. -* The Jest website is now auto-deployed when merging into master. -* Updated `testRegex` to include `test.js` and `spec.js` files. -* Fixes for `babel-plugin-jest-hoist` when using `jest.mock` with three arguments. -* The `JSON` global in `jest-environment-node` now comes from the vm context instead of the parent context. -* Jest does not print stack traces from babel any longer. -* Fake timers are reset when `FakeTimers.useTimers()` is called. -* Usage of Jest in watch mode can be hidden through `JEST_HIDE_USAGE`. -* Added `expect.assertions(number)` which will ensure that a specified amount of assertions is made in one test. -* Added `.toMatchSnapshot(?string)` feature to give snapshots a name. -* Escape regex in snapshots. -* `jest-react-native` was deprecated and now forwards `react-native`. -* Added `.toMatchObject` matcher. -* Further improve printing of large objects. -* Fixed `NaN% Failed` in the OS notification when using `--notify`. -* The first test run without cached timings will now use separate processes instead of running in band. -* Added `.toHaveProperty` matcher. -* Fixed `Map`/`Set` comparisons. -* `test.concurrent` now works with `--testNamePattern`. +- The testResultsProcessor function is now required to return the modified results. +- Removed `pit` and `mockImpl`. Use `it` or `mockImplementation` instead. +- Fixed re-running tests when `--bail` is used together with `--watch`. +- `pretty-format` is now merged into Jest. +- `require('v8')` now works properly in a test context. +- Jest now clears the entire scrollback in watch mode. +- Added `expect.any`, `expect.anything`, `expect.objectContaining`, `expect.arrayContaining`, `expect.stringMatching`. +- Properly resolve `snapshotSerializers`, `setupFiles`, `transform`, `testRunner` and `testResultsProcessor` instead of using `path.resolve`. +- `--testResultsProcessor` is now exposed through the cli. +- Renamed `--jsonOutputFile` to `--outputFile`. +- Added `jest-editor-support` for vscode and Nuclide integration. +- Fixed `test.concurrent` unhandled promise rejections. +- The Jest website is now auto-deployed when merging into master. +- Updated `testRegex` to include `test.js` and `spec.js` files. +- Fixes for `babel-plugin-jest-hoist` when using `jest.mock` with three arguments. +- The `JSON` global in `jest-environment-node` now comes from the vm context instead of the parent context. +- Jest does not print stack traces from babel any longer. +- Fake timers are reset when `FakeTimers.useTimers()` is called. +- Usage of Jest in watch mode can be hidden through `JEST_HIDE_USAGE`. +- Added `expect.assertions(number)` which will ensure that a specified amount of assertions is made in one test. +- Added `.toMatchSnapshot(?string)` feature to give snapshots a name. +- Escape regex in snapshots. +- `jest-react-native` was deprecated and now forwards `react-native`. +- Added `.toMatchObject` matcher. +- Further improve printing of large objects. +- Fixed `NaN% Failed` in the OS notification when using `--notify`. +- The first test run without cached timings will now use separate processes instead of running in band. +- Added `.toHaveProperty` matcher. +- Fixed `Map`/`Set` comparisons. +- `test.concurrent` now works with `--testNamePattern`. ## jest 17.0.3 -* Improved file-watching feature in jest-haste-map. -* Added `.toHaveLength` matcher. -* Improved `.toContain` matcher. +- Improved file-watching feature in jest-haste-map. +- Added `.toHaveLength` matcher. +- Improved `.toContain` matcher. ## jest 17.0.2 -* Fixed performance regression in module resolution. +- Fixed performance regression in module resolution. ## jest 17.0.1 -* Fixed pretty printing of big objects. -* Fixed resolution of `.native.js` files in react-native projects. +- Fixed pretty printing of big objects. +- Fixed resolution of `.native.js` files in react-native projects. ## jest 17.0.0 -* Added `expect.extend`. -* Properly resolve modules with platform extensions on react-native. -* Added support for custom snapshots serializers. -* Updated to Jasmine 2.5.2. -* Big diffs are now collapsed by default in snapshots and assertions. Added `--expand` (or `-e`) to show the full diff. -* Replaced `scriptPreprocessor` with the new `transform` option. -* Added `jest.resetAllMocks` which replaces `jest.clearAllMocks`. -* Fixes for react-native preset. -* Fixes for global built in objects in `jest-environment-node`. -* Create mock objects in the vm context instead of the parent context. -* `.babelrc` is now part of the transform cache key in `babel-jest`. -* Fixes for docblock parsing with haste modules. -* Exit with the proper code when the coverage threshold is not reached. -* Implemented file watching in `jest-haste-map`. -* `--json` now includes information about individual tests inside a file. +- Added `expect.extend`. +- Properly resolve modules with platform extensions on react-native. +- Added support for custom snapshots serializers. +- Updated to Jasmine 2.5.2. +- Big diffs are now collapsed by default in snapshots and assertions. Added `--expand` (or `-e`) to show the full diff. +- Replaced `scriptPreprocessor` with the new `transform` option. +- Added `jest.resetAllMocks` which replaces `jest.clearAllMocks`. +- Fixes for react-native preset. +- Fixes for global built in objects in `jest-environment-node`. +- Create mock objects in the vm context instead of the parent context. +- `.babelrc` is now part of the transform cache key in `babel-jest`. +- Fixes for docblock parsing with haste modules. +- Exit with the proper code when the coverage threshold is not reached. +- Implemented file watching in `jest-haste-map`. +- `--json` now includes information about individual tests inside a file. ## jest 16.0.2 -* Symbols are now properly mocked when using `jest-mock`. -* `toHaveBeenCalledWith()` works without arguments again. -* Newlines in snapshots are now normalized across different operating systems. +- Symbols are now properly mocked when using `jest-mock`. +- `toHaveBeenCalledWith()` works without arguments again. +- Newlines in snapshots are now normalized across different operating systems. ## jest 16.0.1 -* Fix infinite loop. +- Fix infinite loop. ## jest 16.0.0 -* Previously failed tests are now always run first. -* A new concurrent reporter shows currently running tests, a test summary, a progress bar and estimated remaining time if possible. -* Improved CLI colors. -* `jest ` is now case-insensitive. -* Added `it.only`, `it.skip`, `test.only`, `test.skip` and `xtest`. -* Added `--testNamePattern=pattern` or `-t ` to run individual tests in test files. -* Jest now warns for duplicate mock files. -* Pressing `a`, `o`, `p`, `q` or `enter` while tests are running in the watch mode, the test run will be interrupted. -* `--bail` now works together with `--watch`. -* Added `test.concurrent` for concurrent async tests. -* Jest now automatically considers files and tests with the `.jsx` extension. -* Added `jest.clearAllMocks` to clear all mocks manually. -* Rewrote Jest's snapshot implementation. `jest-snapshot` can now be more easily integrated into other test runners and used in other projects. -* This requires most snapshots to be updated when upgrading Jest. -* Objects and Arrays in snapshots are now printed with a trailing comma. -* Function names are not printed in snapshots any longer to reduce issues with code coverage instrumentation and different Node versions. -* Snapshots are now sorted using natural sort order. -* Snapshots are not marked as obsolete any longer when using `fit` or when an error is thrown in a test. -* Finished migration of Jasmine matchers to the new Jest matchers. -* Pretty print `toHaveBeenLastCalledWith`, `toHaveBeenCalledWith`, `lastCalledWith` and `toBeCalledWith` failure messages. -* Added `toBeInstanceOf` matcher. -* Added `toContainEqual` matcher. -* Added `toThrowErrorMatchingSnapshot` matcher. -* Improved `moduleNameMapper` resolution. -* Module registry fixes. -* Fixed invocation of the `setupTestFrameworkScriptFile` script to make it easier to use chai together with Jest. -* Removed react-native special case in Jest's configuration. -* Added `--findRelatedTests ` cli option to run tests related to the specified files. -* Added `jest.deepUnmock` to `babel-plugin-jest-hoist`. -* Added `jest.runTimersToTime` which is useful together with fake timers. -* Improved automated mocks for ES modules compiled with babel. +- Previously failed tests are now always run first. +- A new concurrent reporter shows currently running tests, a test summary, a progress bar and estimated remaining time if possible. +- Improved CLI colors. +- `jest ` is now case-insensitive. +- Added `it.only`, `it.skip`, `test.only`, `test.skip` and `xtest`. +- Added `--testNamePattern=pattern` or `-t ` to run individual tests in test files. +- Jest now warns for duplicate mock files. +- Pressing `a`, `o`, `p`, `q` or `enter` while tests are running in the watch mode, the test run will be interrupted. +- `--bail` now works together with `--watch`. +- Added `test.concurrent` for concurrent async tests. +- Jest now automatically considers files and tests with the `.jsx` extension. +- Added `jest.clearAllMocks` to clear all mocks manually. +- Rewrote Jest's snapshot implementation. `jest-snapshot` can now be more easily integrated into other test runners and used in other projects. +- This requires most snapshots to be updated when upgrading Jest. +- Objects and Arrays in snapshots are now printed with a trailing comma. +- Function names are not printed in snapshots any longer to reduce issues with code coverage instrumentation and different Node versions. +- Snapshots are now sorted using natural sort order. +- Snapshots are not marked as obsolete any longer when using `fit` or when an error is thrown in a test. +- Finished migration of Jasmine matchers to the new Jest matchers. +- Pretty print `toHaveBeenLastCalledWith`, `toHaveBeenCalledWith`, `lastCalledWith` and `toBeCalledWith` failure messages. +- Added `toBeInstanceOf` matcher. +- Added `toContainEqual` matcher. +- Added `toThrowErrorMatchingSnapshot` matcher. +- Improved `moduleNameMapper` resolution. +- Module registry fixes. +- Fixed invocation of the `setupTestFrameworkScriptFile` script to make it easier to use chai together with Jest. +- Removed react-native special case in Jest's configuration. +- Added `--findRelatedTests ` cli option to run tests related to the specified files. +- Added `jest.deepUnmock` to `babel-plugin-jest-hoist`. +- Added `jest.runTimersToTime` which is useful together with fake timers. +- Improved automated mocks for ES modules compiled with babel. ## jest 15.1.1 -* Fixed issues with test paths that include hyphens on Windows. -* Fixed `testEnvironment` resolution. -* Updated watch file name pattern input. +- Fixed issues with test paths that include hyphens on Windows. +- Fixed `testEnvironment` resolution. +- Updated watch file name pattern input. ## jest 15.1.0 -* Pretty printer updates for React and global window objects. -* `jest-runtime` overwrites automocking from configuration files. -* Improvements for watch mode on Windows. -* afterAll/afterEach/beforeAll/beforeEach can now return a Promise and be used together with async/await. -* Improved stack trace printing on Node 4. +- Pretty printer updates for React and global window objects. +- `jest-runtime` overwrites automocking from configuration files. +- Improvements for watch mode on Windows. +- afterAll/afterEach/beforeAll/beforeEach can now return a Promise and be used together with async/await. +- Improved stack trace printing on Node 4. ## jest 15.0.2 -* Fixed Jest with npm2 when using coverage. +- Fixed Jest with npm2 when using coverage. ## jest 15.0.1 -* Updated toThrow and toThrowMatchers and aliased them to the same matcher. -* Improvements for watch mode. -* Fixed Symbol reassignment in tests would break Jest's matchers. -* Fixed `--bail` option. +- Updated toThrow and toThrowMatchers and aliased them to the same matcher. +- Improvements for watch mode. +- Fixed Symbol reassignment in tests would break Jest's matchers. +- Fixed `--bail` option. ## jest 15.0.0 -* See https://facebook.github.io/jest/blog/2016/09/01/jest-15.html -* Jest by default now also recognizes files ending in `.spec.js` and `.test.js` as test files. -* Completely replaced most Jasmine matchers with new Jest matchers. -* Rewrote Jest's CLI output for test failures and summaries. -* Added `--env` option to override the default test environment. -* Disabled automocking, fake timers and resetting the module registry by default. -* Added `--watchAll`, made `--watch` interactive and added the ability to update snapshots and select test patterns in watch mode. -* Jest uses verbose mode when running a single test file. -* Console messages are now buffered and printed along with the test results. -* Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module colision when using `jsdom` as test environment. -* `moduleNameMapper` now uses a resolution algorithm. -* Improved performance for small test runs. -* Improved API documentation. -* Jest now works properly with directories that have special characters in them. -* Improvements to Jest's own test infra by merging integration and unit tests. Code coverage is now collected for Jest. -* Added `global.global` to the node environment. -* Fixed babel-jest-plugin-hoist issues with functions called `mock`. -* Improved jest-react-native preset with mocks for ListView, TextInput, ActivityIndicator and ScrollView. -* Added `collectCoverageFrom` to collect code coverage from untested files. -* Rewritten code coverage support. +- See https://facebook.github.io/jest/blog/2016/09/01/jest-15.html +- Jest by default now also recognizes files ending in `.spec.js` and `.test.js` as test files. +- Completely replaced most Jasmine matchers with new Jest matchers. +- Rewrote Jest's CLI output for test failures and summaries. +- Added `--env` option to override the default test environment. +- Disabled automocking, fake timers and resetting the module registry by default. +- Added `--watchAll`, made `--watch` interactive and added the ability to update snapshots and select test patterns in watch mode. +- Jest uses verbose mode when running a single test file. +- Console messages are now buffered and printed along with the test results. +- Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module colision when using `jsdom` as test environment. +- `moduleNameMapper` now uses a resolution algorithm. +- Improved performance for small test runs. +- Improved API documentation. +- Jest now works properly with directories that have special characters in them. +- Improvements to Jest's own test infra by merging integration and unit tests. Code coverage is now collected for Jest. +- Added `global.global` to the node environment. +- Fixed babel-jest-plugin-hoist issues with functions called `mock`. +- Improved jest-react-native preset with mocks for ListView, TextInput, ActivityIndicator and ScrollView. +- Added `collectCoverageFrom` to collect code coverage from untested files. +- Rewritten code coverage support. ## jest 14.1.0 -* Changed Jest's default cache directory. -* Fixed `jest-react-native` for react 15.3.0. -* Updated react and react-native example to use `react-test-renderer`. -* Started to refactor code coverage. +- Changed Jest's default cache directory. +- Fixed `jest-react-native` for react 15.3.0. +- Updated react and react-native example to use `react-test-renderer`. +- Started to refactor code coverage. ## jest 14.0.2 -* `babel-jest` bugfix. +- `babel-jest` bugfix. ## jest 14.0.1 -* `babel-jest` can now be used to compose a transformer. -* Updated snapshot instructions to run `jest -u` or `npm test -- -u`. -* Fixed `config` cli option to enable JSON objects as configuration. -* Updated printing of preset path in the CLI. +- `babel-jest` can now be used to compose a transformer. +- Updated snapshot instructions to run `jest -u` or `npm test -- -u`. +- Fixed `config` cli option to enable JSON objects as configuration. +- Updated printing of preset path in the CLI. ## jest 14.0.0 -* Official release of snapshot tests. -* Started to replace Jasmine matchers with Jest matchers: `toBe`, `toBeFalsy`, `toBeTruthy`, `toBeNaN`, `toBe{Greater,Less}Than{,OrEqual}`, `toBeNull`, `toBeDefined`, `toBeUndefined`, `toContain`, `toMatch`, `toBeCloseTo` were rewritten. -* Rewrite of Jest's reporters. -* Experimental react-native support. -* Removed Jasmine 1 support from Jest. -* Transform caching improvements. +- Official release of snapshot tests. +- Started to replace Jasmine matchers with Jest matchers: `toBe`, `toBeFalsy`, `toBeTruthy`, `toBeNaN`, `toBe{Greater,Less}Than{,OrEqual}`, `toBeNull`, `toBeDefined`, `toBeUndefined`, `toContain`, `toMatch`, `toBeCloseTo` were rewritten. +- Rewrite of Jest's reporters. +- Experimental react-native support. +- Removed Jasmine 1 support from Jest. +- Transform caching improvements. ## jest 13.2.0 -* Snapshot bugfixes. -* Timer bugfixes. +- Snapshot bugfixes. +- Timer bugfixes. ## jest 13.1.0 -* Added `test` global function as an alias for `it`. -* Added `coveragePathIgnorePatterns` to the config. -* Fixed printing of "JSX objects" in snapshots. -* Fixes for `--verbose` option and top level `it` calls. -* Extended the node environment with more globals. -* testcheck now needs to be required explicitly through `require('jest-check')`. -* Added `jest.deepUnmock`. -* Fail test suite if it does not contain any tests. +- Added `test` global function as an alias for `it`. +- Added `coveragePathIgnorePatterns` to the config. +- Fixed printing of "JSX objects" in snapshots. +- Fixes for `--verbose` option and top level `it` calls. +- Extended the node environment with more globals. +- testcheck now needs to be required explicitly through `require('jest-check')`. +- Added `jest.deepUnmock`. +- Fail test suite if it does not contain any tests. ## jest 13.0.0 -* Added duration of individual tests in verbose mode. -* Added a `browser` config option to properly resolve npm packages with a browser field in `package.json` if you are writing tests for client side apps -* Added `jest-repl`. -* Split up `jest-cli` into `jest-runtime` and `jest-config`. -* Added a notification plugin that shows a test run notification using `--notify`. -* Refactored `TestRunner` into `SearchSource` and improved the "no tests found" message. -* Added `jest.isMockFunction(jest.fn())` to test for mock functions. -* Improved test reporter printing and added a test failure summary when running many tests. - * Add support for property testing via testcheck-js. -* Added a webpack tutorial. -* Added support for virtual mocks through `jest.mock('Module', implementation, {virtual: true})`. -* Added snapshot functionality through `toMatchSnapshot()`. -* Redesigned website. +- Added duration of individual tests in verbose mode. +- Added a `browser` config option to properly resolve npm packages with a browser field in `package.json` if you are writing tests for client side apps +- Added `jest-repl`. +- Split up `jest-cli` into `jest-runtime` and `jest-config`. +- Added a notification plugin that shows a test run notification using `--notify`. +- Refactored `TestRunner` into `SearchSource` and improved the "no tests found" message. +- Added `jest.isMockFunction(jest.fn())` to test for mock functions. +- Improved test reporter printing and added a test failure summary when running many tests. + - Add support for property testing via testcheck-js. +- Added a webpack tutorial. +- Added support for virtual mocks through `jest.mock('Module', implementation, {virtual: true})`. +- Added snapshot functionality through `toMatchSnapshot()`. +- Redesigned website. ## jest-cli 12.1.1 -* Windows stability fixes. -* Mock module resolution fixes. -* Remove test files from code coverage. +- Windows stability fixes. +- Mock module resolution fixes. +- Remove test files from code coverage. ## jest-cli 12.1.0 -* Jest is now also published in the `jest` package on npm. -* Added `testRegex` to match for tests outside of specific folders. Deprecated both `testDirectoryName` and `testFileExtensions`. -* `it` can now return a Promise for async testing. `pit` was deprecated. -* Added `jest-resolve` as a standalone package based on the Facebook module resolution algorithm. -* Added `jest-changed-files` as a standalone package to detect changed files in a git or hg repo. -* Added `--setupTestFrameworkFile` to cli. -* Added support for coverage thresholds. See http://facebook.github.io/jest/docs/api.html#coveragethreshold-object. -* Updated to jsdom 9.0. -* Updated and improved stack trace reporting. -* Added `module.filename` and removed the invalid `module.__filename` field. -* Further improved the `lastCalledWith` and `toBeCalledWith` custom matchers. They now print the most recent calls. -* Fixed jest-haste-map on continuous integration systems. -* Fixes for hg/git integration. -* Added a re-try for the watchman crawler. +- Jest is now also published in the `jest` package on npm. +- Added `testRegex` to match for tests outside of specific folders. Deprecated both `testDirectoryName` and `testFileExtensions`. +- `it` can now return a Promise for async testing. `pit` was deprecated. +- Added `jest-resolve` as a standalone package based on the Facebook module resolution algorithm. +- Added `jest-changed-files` as a standalone package to detect changed files in a git or hg repo. +- Added `--setupTestFrameworkFile` to cli. +- Added support for coverage thresholds. See http://facebook.github.io/jest/docs/api.html#coveragethreshold-object. +- Updated to jsdom 9.0. +- Updated and improved stack trace reporting. +- Added `module.filename` and removed the invalid `module.__filename` field. +- Further improved the `lastCalledWith` and `toBeCalledWith` custom matchers. They now print the most recent calls. +- Fixed jest-haste-map on continuous integration systems. +- Fixes for hg/git integration. +- Added a re-try for the watchman crawler. ## jest-cli 12.0.2 -* Bug fixes when running a single test file and for scoped package names. +- Bug fixes when running a single test file and for scoped package names. ## jest-cli 12.0.1 -* Added custom equality matchers for Map/Set and iterables. -* Bug fixes +- Added custom equality matchers for Map/Set and iterables. +- Bug fixes ## jest-cli 12.0.0 -* Reimplemented `node-haste` as `jest-haste-map`: https://github.com/facebook/jest/pull/896 -* Fixes for the upcoming release of nodejs 6. -* Removed global mock caching which caused negative side-effects on test runs. -* Updated Jasmine from 2.3.4 to 2.4.1. -* Fixed our Jasmine fork to work better with `Object.create(null)`. -* Added a `--silent` flag to silence console messages during a test run. -* Run a test file directly if a path is passed as an argument to Jest. -* Added support for the undocumented nodejs feature `module.paths`. +- Reimplemented `node-haste` as `jest-haste-map`: https://github.com/facebook/jest/pull/896 +- Fixes for the upcoming release of nodejs 6. +- Removed global mock caching which caused negative side-effects on test runs. +- Updated Jasmine from 2.3.4 to 2.4.1. +- Fixed our Jasmine fork to work better with `Object.create(null)`. +- Added a `--silent` flag to silence console messages during a test run. +- Run a test file directly if a path is passed as an argument to Jest. +- Added support for the undocumented nodejs feature `module.paths`. ## jest-cli 11.0.2 -* Fixed `jest -o` error when Mercurial isn't installed on the system -* Fixed Jasmine failure message when expected values were mutated after tests. +- Fixed `jest -o` error when Mercurial isn't installed on the system +- Fixed Jasmine failure message when expected values were mutated after tests. ## jest-cli 11.0.1, babel-jest 11.0.1 -* Added support for Mercurial repositories when using `jest -o` -* Added `mockImplementationOnce` API to `jest.fn()`. +- Added support for Mercurial repositories when using `jest -o` +- Added `mockImplementationOnce` API to `jest.fn()`. ## jest-cli 11.0.0, babel-jest 11.0.0 (pre-releases 0.9 to 0.10) -* New implementation of node-haste and rewrite of internal module loading and resolution. Fixed both startup and runtime performance. [#599](https://github.com/facebook/jest/pull/599) -* Jasmine 2 is now the default test runner. To keep using Jasmine 1, put `testRunner: "jasmine1"` into your configuration. -* Added `jest-util`, `jest-mock`, `jest-jasmine1`, `jest-jasmine2`, `jest-environment-node`, `jest-environment-jsdom` packages. -* Added `babel-jest-preset` and `babel-jest` as packages. `babel-jest` is now being auto-detected. -* Added `babel-plugin-jest-hoist` which hoists `jest.unmock`, `jest.mock` and the new `jest.enableAutomock` and `jest.disableAutomock` API. -* Improved `babel-jest` integration and `react-native` testing. -* Improved code coverage reporting when using `babel-jest`. -* Added the `jest.mock('moduleName', moduleFactory)` feature. `jest.mock` now gets hoisted by default. `jest.doMock` was added to explicitly mock a module without the hoisting feature of `babel-jest`. -* Updated jsdom to 8.3.x. -* Improved responsiveness of the system while using `--watch`. -* Clear the terminal window when using `--watch`. -* By default, `--watch` will now only runs tests related to changed files. `--watch=all` can be used to run all tests on file system changes. -* Debounce `--watch` re-runs to not trigger test runs during a branch switch in version control. -* Added `jest.fn()` and `jest.fn(implementation)` as convenient shorcuts for `jest.genMockFunction()` and `jest.genMockFunction().mockImplementation()`. -* Added an `automock` option to turn off automocking globally. -* Added a "no tests found" message if no tests can be found. -* Jest sets `process.NODE_ENV` to `test` unless otherwise specified. -* Fixed `moduleNameMapper` config option when used with paths. -* Fixed an error with Jasmine 2 and tests that `throw 'string errors'`. -* Fixed issues with unmocking symlinked module names. -* Fixed mocking of boolean values. -* Fixed mocking of fields that start with an underscore ("private fields"). -* Fixed unmocking behavior with npm3. -* Fixed and improved `--onlyChanged` option. -* Fixed support for running Jest as a git submodule. -* Improved verbose logger output -* Fixed test runtime error reporting and stack traces. -* Improved `toBeCalled` Jasmine 2 custom matcher messages. -* Improved error reporting when a syntax error occurs. -* Renamed HasteModuleLoader to Runtime. -* Jest now properly reports pending tests disabled with `xit` and `xdescribe`. -* Removed `preprocessCachingDisabled` config option. -* Added a `testEnvironment` option to customize the sandbox environment. -* Added support for `@scoped/name` npm packages. -* Added an integration test runner for Jest that runs all tests for examples and packages. +- New implementation of node-haste and rewrite of internal module loading and resolution. Fixed both startup and runtime performance. [#599](https://github.com/facebook/jest/pull/599) +- Jasmine 2 is now the default test runner. To keep using Jasmine 1, put `testRunner: "jasmine1"` into your configuration. +- Added `jest-util`, `jest-mock`, `jest-jasmine1`, `jest-jasmine2`, `jest-environment-node`, `jest-environment-jsdom` packages. +- Added `babel-jest-preset` and `babel-jest` as packages. `babel-jest` is now being auto-detected. +- Added `babel-plugin-jest-hoist` which hoists `jest.unmock`, `jest.mock` and the new `jest.enableAutomock` and `jest.disableAutomock` API. +- Improved `babel-jest` integration and `react-native` testing. +- Improved code coverage reporting when using `babel-jest`. +- Added the `jest.mock('moduleName', moduleFactory)` feature. `jest.mock` now gets hoisted by default. `jest.doMock` was added to explicitly mock a module without the hoisting feature of `babel-jest`. +- Updated jsdom to 8.3.x. +- Improved responsiveness of the system while using `--watch`. +- Clear the terminal window when using `--watch`. +- By default, `--watch` will now only runs tests related to changed files. `--watch=all` can be used to run all tests on file system changes. +- Debounce `--watch` re-runs to not trigger test runs during a branch switch in version control. +- Added `jest.fn()` and `jest.fn(implementation)` as convenient shorcuts for `jest.genMockFunction()` and `jest.genMockFunction().mockImplementation()`. +- Added an `automock` option to turn off automocking globally. +- Added a "no tests found" message if no tests can be found. +- Jest sets `process.NODE_ENV` to `test` unless otherwise specified. +- Fixed `moduleNameMapper` config option when used with paths. +- Fixed an error with Jasmine 2 and tests that `throw 'string errors'`. +- Fixed issues with unmocking symlinked module names. +- Fixed mocking of boolean values. +- Fixed mocking of fields that start with an underscore ("private fields"). +- Fixed unmocking behavior with npm3. +- Fixed and improved `--onlyChanged` option. +- Fixed support for running Jest as a git submodule. +- Improved verbose logger output +- Fixed test runtime error reporting and stack traces. +- Improved `toBeCalled` Jasmine 2 custom matcher messages. +- Improved error reporting when a syntax error occurs. +- Renamed HasteModuleLoader to Runtime. +- Jest now properly reports pending tests disabled with `xit` and `xdescribe`. +- Removed `preprocessCachingDisabled` config option. +- Added a `testEnvironment` option to customize the sandbox environment. +- Added support for `@scoped/name` npm packages. +- Added an integration test runner for Jest that runs all tests for examples and packages. ## 0.8.2 -* Performance improvements. -* jest now uses `chalk` instead of its own colors implementation. +- Performance improvements. +- jest now uses `chalk` instead of its own colors implementation. ## 0.8.1 -* `--bail` now reports with the proper error code. -* Fixed loading of the setup file when using jasmine2. -* Updated jsdom to 7.2.0. +- `--bail` now reports with the proper error code. +- Fixed loading of the setup file when using jasmine2. +- Updated jsdom to 7.2.0. ## 0.8.0 -* Added optional support for jasmine2 through the `testRunner` config option. -* Fixed mocking support for Map, WeakMap and Set. -* `node` was added to the defaults in `moduleFileExtensions`. -* Updated the list of node core modules that are properly being recognized by the module loader. +- Added optional support for jasmine2 through the `testRunner` config option. +- Fixed mocking support for Map, WeakMap and Set. +- `node` was added to the defaults in `moduleFileExtensions`. +- Updated the list of node core modules that are properly being recognized by the module loader. ## 0.7.1 -* Correctly map `process.on` into jsdom environments, fixes a bug introduced in jest 0.7.0. +- Correctly map `process.on` into jsdom environments, fixes a bug introduced in jest 0.7.0. ## 0.7.0 -* Fixed a memory leak with test contexts. Jest now properly cleans up test environments after each test. Added `--logHeapUsage` to log memory usage after each test. Note: this is option is meant for debugging memory leaks and might significantly slow down your test run. -* Removed `mock-modules`, `node-haste` and `mocks` virtual modules. This is a breaking change of undocumented public API. Usage of this API can safely be automatically updated through an automated codemod: -* Example: http://astexplorer.net/#/zrybZ6UvRA -* Codemod: https://github.com/cpojer/js-codemod/blob/master/transforms/jest-update.js -* jscodeshift: https://github.com/facebook/jscodeshift -* Removed `navigator.onLine` and `mockSetReadOnlyProperty` from the global jsdom environment. Use `window.navigator.onLine = true;` in your test setup and `Object.defineProperty` instead. +- Fixed a memory leak with test contexts. Jest now properly cleans up test environments after each test. Added `--logHeapUsage` to log memory usage after each test. Note: this is option is meant for debugging memory leaks and might significantly slow down your test run. +- Removed `mock-modules`, `node-haste` and `mocks` virtual modules. This is a breaking change of undocumented public API. Usage of this API can safely be automatically updated through an automated codemod: +- Example: http://astexplorer.net/#/zrybZ6UvRA +- Codemod: https://github.com/cpojer/js-codemod/blob/master/transforms/jest-update.js +- jscodeshift: https://github.com/facebook/jscodeshift +- Removed `navigator.onLine` and `mockSetReadOnlyProperty` from the global jsdom environment. Use `window.navigator.onLine = true;` in your test setup and `Object.defineProperty` instead. ## 0.6.1 -* Updated jsdom to 7.0.2. -* Use the current working directory as root when passing a jest config from the command line. -* Updated the React examples and getting started guide -* Modules now receive a `module.parent` field so unmocked modules don't assume they are run directly any longer. +- Updated jsdom to 7.0.2. +- Use the current working directory as root when passing a jest config from the command line. +- Updated the React examples and getting started guide +- Modules now receive a `module.parent` field so unmocked modules don't assume they are run directly any longer. ## 0.6.0 -* jest now reports the number of tests that were run instead of the number of test files. -* Added a `--json` option to print test results as JSON. -* Changed the preprocessor API. A preprocessor now receives the script, file and config. The cache key function receives the script, file and stringified config to be able to create consistent hashes. -* Removed node-worker-pool in favor of node-worker-farm (#540). -* `toEqual` now also checks the internal class name of an object. This fixes invalid tests like `expect([]).toEqual({})` which were previously passing. -* Added the option to provide map modules to stub modules by providing the `moduleNameMapper` config option. -* Allow to specify a custom `testRunner` in the configuration (#531). -* Added a `--no-cache` option to make it easier to debug preprocessor scripts. -* Fix code coverage on windows (#499). +- jest now reports the number of tests that were run instead of the number of test files. +- Added a `--json` option to print test results as JSON. +- Changed the preprocessor API. A preprocessor now receives the script, file and config. The cache key function receives the script, file and stringified config to be able to create consistent hashes. +- Removed node-worker-pool in favor of node-worker-farm (#540). +- `toEqual` now also checks the internal class name of an object. This fixes invalid tests like `expect([]).toEqual({})` which were previously passing. +- Added the option to provide map modules to stub modules by providing the `moduleNameMapper` config option. +- Allow to specify a custom `testRunner` in the configuration (#531). +- Added a `--no-cache` option to make it easier to debug preprocessor scripts. +- Fix code coverage on windows (#499). ## 0.5.6 -* Cache test run performance and run slowest tests first to maximize worker utilization -* Update to jsdom 6.5.0 +- Cache test run performance and run slowest tests first to maximize worker utilization +- Update to jsdom 6.5.0 ## 0.5.5 -* Improve failure stack traces. -* Fix syntax error reporting. -* Add `--watch` option (#472). +- Improve failure stack traces. +- Fix syntax error reporting. +- Add `--watch` option (#472). ## 0.5.2 -* Fixed a bug with syntax errors in test files (#487). -* Fixed chmod error for preprocess-cache (#491). -* Support for the upcoming node 4.0 release (#490, #489). +- Fixed a bug with syntax errors in test files (#487). +- Fixed chmod error for preprocess-cache (#491). +- Support for the upcoming node 4.0 release (#490, #489). ## 0.5.1 -* Upgraded node-worker-pool to 3.0.0, use the native `Promise` implementation. -* `testURL` can be used to set the location of the jsdom environment. -* Updated all of jest's dependencies, now using jsdom 6.3. -* jest now uses the native `Promise` implementation. -* Fixed a bug when passed an empty `testPathIgnorePatterns`. -* Moved preprocessor cache into the haste cache directory. +- Upgraded node-worker-pool to 3.0.0, use the native `Promise` implementation. +- `testURL` can be used to set the location of the jsdom environment. +- Updated all of jest's dependencies, now using jsdom 6.3. +- jest now uses the native `Promise` implementation. +- Fixed a bug when passed an empty `testPathIgnorePatterns`. +- Moved preprocessor cache into the haste cache directory. ## 0.5.0 -* Added `--noStackTrace` option to disable stack traces. -* Jest now only works with iojs v2 and up. If you are still using node we recommend upgrading to iojs or keep using jest 0.4.0. -* Upgraded to jsdom 6.1.0 and removed all the custom jsdom overwrites. +- Added `--noStackTrace` option to disable stack traces. +- Jest now only works with iojs v2 and up. If you are still using node we recommend upgrading to iojs or keep using jest 0.4.0. +- Upgraded to jsdom 6.1.0 and removed all the custom jsdom overwrites. ## <=0.4.0 -* See commit history for changes in previous versions of jest. +- See commit history for changes in previous versions of jest. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41ecc8f264e4..8c03c34a684b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,7 +112,7 @@ cd /path/to/another/project jest [options] # run jest-cli/bin/jest.js in the development build ``` -* To decide whether to specify any options, see `test` under `scripts` in the `package.json` file of the other project. +- To decide whether to specify any options, see `test` under `scripts` in the `package.json` file of the other project. To unlink `jest` on the command line from `jest-cli/bin/jest.js` in a development build: @@ -136,18 +136,18 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe ## How to Get in Touch -* Discord - [#jest](https://discord.gg/MWRhKCj) on [Reactiflux](http://www.reactiflux.com/) +- Discord - [#jest](https://discord.gg/MWRhKCj) on [Reactiflux](http://www.reactiflux.com/) ## Code Conventions -* 2 spaces for indentation (no tabs). -* 80 character line length strongly preferred. -* Prefer `'` over `"`. -* ES6 syntax when possible. -* Use [Flow types](http://flowtype.org/). -* Use semicolons; -* Trailing commas, -* Avd abbr wrds. +- 2 spaces for indentation (no tabs). +- 80 character line length strongly preferred. +- Prefer `'` over `"`. +- ES6 syntax when possible. +- Use [Flow types](http://flowtype.org/). +- Use semicolons; +- Trailing commas, +- Avd abbr wrds. ## License diff --git a/README.md b/README.md index 6a217a869f50..5cf3c9553a31 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ 🃏 Delightful JavaScript Testing -* **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. +- **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. -* **🏃🏽 Instant Feedback**: Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly. +- **🏃🏽 Instant Feedback**: Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly. -* **📸 Snapshot Testing**: Capture snapshots of React trees or other serializable values to simplify testing and to analyze how state changes over time. +- **📸 Snapshot Testing**: Capture snapshots of React trees or other serializable values to simplify testing and to analyze how state changes over time. ## Getting Started @@ -142,10 +142,10 @@ To use TypeScript in your tests you can use [ts-jest](https://github.com/kulshek Learn more about using [Jest on the official site!](http://facebook.github.io/jest) -* [Getting Started](http://facebook.github.io/jest/docs/en/getting-started.html) -* [Guides](http://facebook.github.io/jest/docs/en/snapshot-testing.html) -* [API Reference](http://facebook.github.io/jest/docs/en/api.html) -* [Configuring Jest](http://facebook.github.io/jest/docs/en/configuration.html) +- [Getting Started](http://facebook.github.io/jest/docs/en/getting-started.html) +- [Guides](http://facebook.github.io/jest/docs/en/snapshot-testing.html) +- [API Reference](http://facebook.github.io/jest/docs/en/api.html) +- [Configuring Jest](http://facebook.github.io/jest/docs/en/configuration.html) ## Badge diff --git a/docs/Configuration.md b/docs/Configuration.md index 697804822bdc..aa939af929fe 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -234,10 +234,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -375,12 +375,12 @@ Specifies notification mode. Requires `notify: true`. #### Modes -* `always`: always send a notification. -* `failure`: send a notification when tests fail. -* `success`: send a notification when tests pass. -* `change`: send a notification when the status changed. -* `success-change`: send a notification when tests pass or once when it fails. -* `failure-success`: send a notification when tests fails or once when it passes. +- `always`: always send a notification. +- `failure`: send a notification when tests fail. +- `success`: send a notification when tests pass. +- `change`: send a notification when the status changed. +- `success-change`: send a notification when tests pass or once when it fails. +- `failure-success`: send a notification when tests fails or once when it passes. ### `preset` [string] @@ -566,10 +566,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index a1c827f081b1..8cfc199be6fa 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -190,8 +190,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -358,9 +358,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -398,8 +398,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. @@ -1037,8 +1037,8 @@ Use `.toStrictEqual` to test that objects have the same types as well as structu Differences from `.toEqual`: -* Keys with `undefined` properties are checked. e.g. `{a: undefined, b: 2}` does not match `{b: 2}` when using `.toStrictEqual`. -* Object types are checked to be equal. e.g. A class instance with fields `a` and `b` will not equal a literal object with fields `a` and `b`. +- Keys with `undefined` properties are checked. e.g. `{a: undefined, b: 2}` does not match `{b: 2}` when using `.toStrictEqual`. +- Object types are checked to be equal. e.g. A class instance with fields `a` and `b` will not equal a literal object with fields `a` and `b`. ```js class LaCroix { diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index 78c1208c95e3..73204eaeb58a 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -230,17 +230,17 @@ 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. -* `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. +- `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: @@ -265,11 +265,11 @@ describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( #### 2. `` describe.each`table`(name, fn) `` -* `table`: `Tagged Template Literal` - * First row of variable name column headings separated with `|` - * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -* `name`: `String` the title of the test suite, use `$variable` to inject test data into the suite title from the tagged template expressions. -* `fn`: `Function` the suite of tests to be ran, this is the function that will receive the test data object. +- `table`: `Tagged Template Literal` + - First row of variable name column headings separated with `|` + - One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- `name`: `String` the title of the test suite, use `$variable` to inject test data into the suite title from the tagged template expressions. +- `fn`: `Function` the suite of tests to be ran, this is the function that will receive the test data object. Example: @@ -474,17 +474,17 @@ 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. -* `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. +- `fn`: `Function` the test to be ran, this is the function that will receive the parameters in each row as function arguments. Example: @@ -499,11 +499,11 @@ test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( #### 2. `` test.each`table`(name, fn) `` -* `table`: `Tagged Template Literal` - * First row of variable name column headings separated with `|` - * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -* `name`: `String` the title of the test, use `$variable` to inject test data into the test title from the tagged template expressions. -* `fn`: `Function` the test to be ran, this is the function that will receive the test data object. +- `table`: `Tagged Template Literal` + - First row of variable name column headings separated with `|` + - One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- `name`: `String` the title of the test, use `$variable` to inject test data into the test title from the tagged template expressions. +- `fn`: `Function` the test to be ran, this is the function that will receive the test data object. Example: diff --git a/docs/JestCommunity.md b/docs/JestCommunity.md index 6f29ae016961..d443a1fdde7d 100644 --- a/docs/JestCommunity.md +++ b/docs/JestCommunity.md @@ -7,10 +7,10 @@ The community around Jest is working hard to make the testing experience even gr [jest-community](https://github.com/jest-community) is a new GitHub organization for high quality Jest additions curated by Jest maintainers and collaborators. It already features some of our favorite projects, to name a few: -* [vscode-jest](https://github.com/jest-community/vscode-jest) -* [jest-extended](https://github.com/jest-community/jest-extended) -* [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) -* [awesome-jest](https://github.com/jest-community/awesome-jest) +- [vscode-jest](https://github.com/jest-community/vscode-jest) +- [jest-extended](https://github.com/jest-community/jest-extended) +- [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) +- [awesome-jest](https://github.com/jest-community/awesome-jest) Community projects under one organisation are a great way for Jest to experiment with new ideas/techniques and approaches. Encourage contributions from the community and publish contributions independently at a faster pace. diff --git a/docs/JestObjectAPI.md b/docs/JestObjectAPI.md index 9afb5bf05914..31ed2e713d56 100644 --- a/docs/JestObjectAPI.md +++ b/docs/JestObjectAPI.md @@ -7,30 +7,30 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) -* [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) --- diff --git a/docs/JestPlatform.md b/docs/JestPlatform.md index 549e02dce31e..62339b274bb3 100644 --- a/docs/JestPlatform.md +++ b/docs/JestPlatform.md @@ -9,8 +9,8 @@ You can cherry pick specific features of Jest and use them as standalone package Tool for identifying modified files in a git/hg repository. Exports two functions: -* `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. -* `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. +- `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. +- `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. ### Example @@ -95,8 +95,8 @@ console.log(getType(undefinedValue)); Tool for validating configurations submitted by users. Exports a function that takes two arguments: the user's configuration and an object containing an example configuration and other options. The return value is an object with two attributes: -* `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, -* `isValid`, a boolean indicating whether the configuration is correct or not. +- `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, +- `isValid`, a boolean indicating whether the configuration is correct or not. ### Example diff --git a/docs/MigrationGuide.md b/docs/MigrationGuide.md index bb5ccaa98d79..534258d3d9f9 100644 --- a/docs/MigrationGuide.md +++ b/docs/MigrationGuide.md @@ -5,9 +5,9 @@ title: Migrating to Jest If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/docs/MoreResources.md b/docs/MoreResources.md index e2c2aeb318e0..ff5fca627321 100644 --- a/docs/MoreResources.md +++ b/docs/MoreResources.md @@ -7,11 +7,11 @@ By now you should have a good idea of how Jest can make it easy to test your app ### Browse the docs -* Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. -* Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). -* Learn how to [configure Jest](Configuration.md). -* Look at the full [API Reference](GlobalAPI.md). -* [Troubleshoot](Troubleshooting.md) problems with Jest. +- Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. +- Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). +- Learn how to [configure Jest](Configuration.md). +- Look at the full [API Reference](GlobalAPI.md). +- [Troubleshoot](Troubleshooting.md) problems with Jest. ### Learn by example diff --git a/docs/TestingFrameworks.md b/docs/TestingFrameworks.md index d6b13ec70a13..42b49be881d7 100644 --- a/docs/TestingFrameworks.md +++ b/docs/TestingFrameworks.md @@ -7,22 +7,22 @@ Although Jest may be considered a React-specific test runner, in fact it is a un ## Vue.js -* [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) -* [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) +- [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) +- [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) ## AngularJS -* [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) -* [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) +- [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) +- [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) ## Angular -* [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) +- [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) ## MobX -* [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) +- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) ## Redux -* [Writing Tests](https://redux.js.org/recipes/writing-tests) by Redux docs +- [Writing Tests](https://redux.js.org/recipes/writing-tests) by Redux docs diff --git a/docs/UsingMatchers.md b/docs/UsingMatchers.md index 5a8295bda252..b90bd83121be 100644 --- a/docs/UsingMatchers.md +++ b/docs/UsingMatchers.md @@ -45,11 +45,11 @@ test('adding positive numbers is not zero', () => { In tests you sometimes need to distinguish between `undefined`, `null`, and `false`, but you sometimes do not want to treat these differently. Jest contains helpers that let you be explicit about what you want. -* `toBeNull` matches only `null` -* `toBeUndefined` matches only `undefined` -* `toBeDefined` is the opposite of `toBeUndefined` -* `toBeTruthy` matches anything that an `if` statement treats as true -* `toBeFalsy` matches anything that an `if` statement treats as false +- `toBeNull` matches only `null` +- `toBeUndefined` matches only `undefined` +- `toBeDefined` is the opposite of `toBeUndefined` +- `toBeTruthy` matches anything that an `if` statement treats as true +- `toBeFalsy` matches anything that an `if` statement treats as false For example: diff --git a/docs/WatchPlugins.md b/docs/WatchPlugins.md index 4ac39f14776c..edf7e3441336 100644 --- a/docs/WatchPlugins.md +++ b/docs/WatchPlugins.md @@ -78,7 +78,7 @@ class MyWatchPlugin { Gets called whenever there is a change in the file system -* `projects: Array`: Includes all the test paths that Jest is watching. +- `projects: Array`: Includes all the test paths that Jest is watching. For example: @@ -128,8 +128,8 @@ Watch Usage To handle key press events from the key returned by `getUsageInfo`, you can implement the `run` method. This method returns a `Promise` that can be resolved when the plugin wants to return control to Jest. The `boolean` specifies if Jest should rerun the tests after it gets the control back. -* `globalConfig`: A representation of Jest's current global configuration -* `updateConfigAndRun`: Allows you to trigger a test run while the interactive plugin is running. +- `globalConfig`: A representation of Jest's current global configuration +- `updateConfigAndRun`: Allows you to trigger a test run while the interactive plugin is running. ```javascript class MyWatchPlugin { diff --git a/e2e/__tests__/__snapshots__/each.test.js.snap b/e2e/__tests__/__snapshots__/each.test.js.snap index 5d3a38d5d10c..fa69c42a75f1 100644 --- a/e2e/__tests__/__snapshots__/each.test.js.snap +++ b/e2e/__tests__/__snapshots__/each.test.js.snap @@ -35,7 +35,7 @@ exports[`shows error message when not enough arguments are supplied to tests 1`] | ^ 9 | left | right 10 | \${true} | \${true} - 11 | \${true} | + 11 | \${true} at __tests__/each-exception.test.js:8:1 diff --git a/e2e/babel-plugin-jest-hoist/__tests__/integration.test.js b/e2e/babel-plugin-jest-hoist/__tests__/integration.test.js index 2d09b1122a70..52c1eed42c1a 100644 --- a/e2e/babel-plugin-jest-hoist/__tests__/integration.test.js +++ b/e2e/babel-plugin-jest-hoist/__tests__/integration.test.js @@ -64,7 +64,10 @@ myObject.mock('apple', 27); describe('babel-plugin-jest-hoist', () => { it('does not throw during transform', () => { const object = {}; - object.__defineGetter__('foo', () => 'bar'); + object.__defineGetter__( + 'foo', + () => 'bar' + ); expect(object.foo).toEqual('bar'); }); diff --git a/e2e/each/__tests__/each-exception.test.js b/e2e/each/__tests__/each-exception.test.js index 766fd719f649..6920a828aa27 100644 --- a/e2e/each/__tests__/each-exception.test.js +++ b/e2e/each/__tests__/each-exception.test.js @@ -8,7 +8,7 @@ it.each` left | right ${true} | ${true} - ${true} | + ${true} `( 'throws exception when not enough arguments are supplied $left == $right', ({left, right}) => { diff --git a/e2e/each/__tests__/failure.test.js b/e2e/each/__tests__/failure.test.js index 0ae31f13d164..c4e430c960dc 100644 --- a/e2e/each/__tests__/failure.test.js +++ b/e2e/each/__tests__/failure.test.js @@ -20,10 +20,10 @@ it.each([[1, 2], [3, 4]])( ); it.each` - left | right - ${true} | ${false} - ${true} | ${true} - `( + left | right + ${true} | ${false} + ${true} | ${true} +`( 'template table fails on one row expected: $left == $right', ({left, right}) => { expect(left).toBe(right); @@ -31,10 +31,10 @@ it.each` ); it.each` - left | right - ${1} | ${2} - ${3} | ${4} - `( + left | right + ${1} | ${2} + ${3} | ${4} +`( 'template table fails on all rows expected: $left == $right', ({left, right}) => { expect(left).toBe(right); @@ -49,10 +49,10 @@ test.each(['red', 'green', 'bean'])( ); describe.each` - left | right - ${'a'} | ${'b'} - ${'c'} | ${'d'} - `( + left | right + ${'a'} | ${'b'} + ${'c'} | ${'d'} +`( 'template table describe fails on all rows expected $left == $right', ({left, right}) => { it('fails ', () => { diff --git a/package.json b/package.json index cf75cef803c0..129c533ff66d 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "mkdirp": "^0.5.1", "mocha": "^5.0.1", "mock-fs": "^4.4.1", - "prettier": "^1.12.1", + "prettier": "^1.13.2", "prettylint": "^1.0.0", "progress": "^2.0.0", "readable-stream": "^2.3.6", diff --git a/packages/diff-sequences/README.md b/packages/diff-sequences/README.md index 349d659f59de..bdee0d11824b 100644 --- a/packages/diff-sequences/README.md +++ b/packages/diff-sequences/README.md @@ -8,8 +8,8 @@ To maximize flexibility and minimize memory, you write **callback** functions as **Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes. -* Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion. -* Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data. +- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion. +- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data. **Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function. @@ -23,13 +23,13 @@ This package implements the **linear space** variation with optimizations so it To add this package as a dependency of a project, do either of the following: -* `npm install diff-sequences` -* `yarn add diff-sequences` +- `npm install diff-sequences` +- `yarn add diff-sequences` To use `diff` as the name of the default export from this package, do either of the following: -* `var diff = require('diff-sequences'); // CommonJS modules` -* `import diff from 'diff-sequences'; // ECMAScript modules` +- `var diff = require('diff-sequences'); // CommonJS modules` +- `import diff from 'diff-sequences'; // ECMAScript modules` Call `diff` with the **lengths** of sequences and your **callback** functions: @@ -103,15 +103,15 @@ var commonLength = countCommonItems( If the length difference `b.length - a.length` is: -* negative: its absolute value is the minimum number of items to **delete** from `a` -* positive: it is the minimum number of items to **insert** from `b` -* zero: there is an **equal** number of items to delete from `a` and insert from `b` -* non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b` +- negative: its absolute value is the minimum number of items to **delete** from `a` +- positive: it is the minimum number of items to **insert** from `b` +- zero: there is an **equal** number of items to delete from `a` and insert from `b` +- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b` In this example, `6 - 7` is: -* negative: `1` is the minimum number of items to **delete** from `a` -* non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b` +- negative: `1` is the minimum number of items to **delete** from `a` +- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b` ## Example of callback functions to find common items @@ -172,9 +172,9 @@ const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => { Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**: -* **c**hange adjacent lines from the first file to lines from the second file -* **d**elete lines from the first file -* **a**ppend or insert lines from the second file +- **c**hange adjacent lines from the first file to lines from the second file +- **d**elete lines from the first file +- **a**ppend or insert lines from the second file ```js // Given zero-based half-open range [start, end) of array indexes, diff --git a/packages/expect/src/utils.js b/packages/expect/src/utils.js index c25e9cc46c5d..fa01bcdc86b0 100644 --- a/packages/expect/src/utils.js +++ b/packages/expect/src/utils.js @@ -58,7 +58,10 @@ export const getPath = ( result.traversedPath.unshift(prop); if (lastProp) { - result.hasEndProp = hasOwnProperty(object, prop); + result.hasEndProp = hasOwnProperty( + object, + prop, + ); if (!result.hasEndProp) { result.traversedPath.shift(); } @@ -91,7 +94,12 @@ export const getObjectSubset = (object: Object, subset: Object) => { ) { const trimmed = {}; Object.keys(subset) - .filter(key => hasOwnProperty(object, key)) + .filter(key => + hasOwnProperty( + object, + key, + ), + ) .forEach( key => (trimmed[key] = getObjectSubset(object[key], subset[key])), ); @@ -207,7 +215,10 @@ export const subsetEquality = (object: Object, subset: Object) => { return Object.keys(subset).every( key => object != null && - hasOwnProperty(object, key) && + hasOwnProperty( + object, + key, + ) && equals(object[key], subset[key], [iterableEquality, subsetEquality]), ); }; diff --git a/packages/jest-changed-files/README.md b/packages/jest-changed-files/README.md index 780ce6c1922f..1911bfcd5ea2 100644 --- a/packages/jest-changed-files/README.md +++ b/packages/jest-changed-files/README.md @@ -20,8 +20,8 @@ roots: Array of string paths gathered from [jest roots](https://facebook.github. options: Object literal with keys -* lastCommit: boolean -* withAncestor: boolean +- lastCommit: boolean +- withAncestor: boolean ### findRepos(roots: >): Promise diff --git a/packages/jest-cli/README.md b/packages/jest-cli/README.md index b9a9b3e72799..8213f3605bf1 100644 --- a/packages/jest-cli/README.md +++ b/packages/jest-cli/README.md @@ -2,10 +2,10 @@ 🃏 Delightful JavaScript Testing -* **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. +- **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. -* **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. +- **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. -* **📸 Snapshot Testing**: Jest can [capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. +- **📸 Snapshot Testing**: Jest can [capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. Read More: http://facebook.github.io/jest/ diff --git a/packages/jest-cli/src/reporters/utils.js b/packages/jest-cli/src/reporters/utils.js index 30bbf4b07c51..bdea97306ef9 100644 --- a/packages/jest-cli/src/reporters/utils.js +++ b/packages/jest-cli/src/reporters/utils.js @@ -196,7 +196,7 @@ const renderTime = (runTime, estimatedTime, width) => { if (estimatedTime > 2 && runTime < estimatedTime && width) { const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width); const length = Math.min( - Math.floor(runTime / estimatedTime * availableWidth), + Math.floor((runTime / estimatedTime) * availableWidth), availableWidth, ); if (availableWidth >= 2) { diff --git a/packages/jest-docblock/README.md b/packages/jest-docblock/README.md index a73a82e1004f..ba3fc7b65069 100644 --- a/packages/jest-docblock/README.md +++ b/packages/jest-docblock/README.md @@ -32,9 +32,9 @@ Pragmas can also take arguments: `jest-docblock` can: -* extract the docblock from some code as a string -* parse a docblock string's pragmas into an object -* print an object and some comments back to a string +- extract the docblock from some code as a string +- parse a docblock string's pragmas into an object +- print an object and some comments back to a string ## Installation diff --git a/packages/jest-each/README.md b/packages/jest-each/README.md index d0ed999de85b..aadfc1be5460 100644 --- a/packages/jest-each/README.md +++ b/packages/jest-each/README.md @@ -13,38 +13,38 @@ 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. -* 🖖 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. +- 🖖 Spock like data tables with [Tagged Template Literals](#tagged-template-literal-of-rows) --- -* [Demo](#demo) -* [Installation](#installation) -* [Importing](#importing) -* APIs - * [Array of Rows](#array-of-rows) - * [Usage](#usage) - * [Tagged Template Literal of rows](#tagged-template-literal-of-rows) - * [Usage](#usage-1) +- [Demo](#demo) +- [Installation](#installation) +- [Importing](#importing) +- APIs + - [Array of Rows](#array-of-rows) + - [Usage](#usage) + - [Tagged Template Literal of rows](#tagged-template-literal-of-rows) + - [Usage](#usage-1) ## Demo @@ -94,39 +94,39 @@ const each = require('jest-each'); ##### `each`: -* parameters: `Array` of Arrays with the arguments that are passed into the `testFn` for each row +- parameters: `Array` of Arrays with the arguments that are passed into the `testFn` for each row ##### `.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. -* 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)` ##### `each`: -* parameters: `Array` of Arrays with the arguments that are passed into the `suiteFn` for each row +- parameters: `Array` of Arrays with the arguments that are passed into the `suiteFn` for each row ##### `.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. -* 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 @@ -260,13 +260,13 @@ each` ##### `each` takes a tagged template string with: -* First row of variable name column headings seperated with `|` -* One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- First row of variable name column headings seperated with `|` +- One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. ##### `.test`: -* name: `String` the title of the `test`, use `$variable` in the name string to inject test values into the test title from the tagged template expressions -* 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`, use `$variable` in the name string to inject test values into the test title from the tagged template expressions +- testFn: `Function` the test logic, this is the function that will receive the parameters of each row as function arguments #### `each[tagged template].describe(name, suiteFn)` @@ -295,13 +295,13 @@ each` ##### `each` takes a tagged template string with: -* First row of variable name column headings seperated with `|` -* One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- First row of variable name column headings seperated with `|` +- One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. ##### `.describe`: -* name: `String` the title of the `test`, use `$variable` in the name string to inject test values into the test title from the tagged template expressions -* 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 `test`, use `$variable` in the name string to inject test values into the test title from the tagged template expressions +- 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 diff --git a/packages/jest-editor-support/src/Runner.js b/packages/jest-editor-support/src/Runner.js index 8bd124625ad6..64d51a091dfb 100644 --- a/packages/jest-editor-support/src/Runner.js +++ b/packages/jest-editor-support/src/Runner.js @@ -157,7 +157,11 @@ export default class Runner extends EventEmitter { } findMessageType(buf: Buffer) { - const str = buf.toString('utf8', 0, 58); + const str = buf.toString( + 'utf8', + 0, + 58, + ); if (str === 'No tests found related to files changed since last commit.') { return messageTypes.noTests; } diff --git a/packages/jest-mock/README.md b/packages/jest-mock/README.md index dabc25b84b4c..6ac96ee24ee2 100644 --- a/packages/jest-mock/README.md +++ b/packages/jest-mock/README.md @@ -84,5 +84,5 @@ Syntactic sugar for .mockImplementation(function() {return this;}) In case both `mockImplementationOnce()/mockImplementation()` and `mockReturnValueOnce()/mockReturnValue()` are called. The priority of which to use is based on what is the last call: -* if the last call is mockReturnValueOnce() or mockReturnValue(), use the specific return value or default return value. If specific return values are used up or no default return value is set, fall back to try mockImplementation(); -* if the last call is mockImplementationOnce() or mockImplementation(), run the specific implementation and return the result or run default implementation and return the result. +- if the last call is mockReturnValueOnce() or mockReturnValue(), use the specific return value or default return value. If specific return values are used up or no default return value is set, fall back to try mockImplementation(); +- if the last call is mockImplementationOnce() or mockImplementation(), run the specific implementation and return the result or run default implementation and return the result. diff --git a/packages/jest-phabricator/README.md b/packages/jest-phabricator/README.md index 52a09613bca7..7ede53019c97 100644 --- a/packages/jest-phabricator/README.md +++ b/packages/jest-phabricator/README.md @@ -18,7 +18,7 @@ You need to add the jest unit engine to your .arcconfig: In `JestUnitTestEngine` there are a couple of constants you probably need to modify: -* `PROCESSOR` points to the path or the processor -* `JEST_PATH` is the path to Jest +- `PROCESSOR` points to the path or the processor +- `JEST_PATH` is the path to Jest If you need to pass to Jest a custom configuration you can either use `JEST_PATH` and point it to a bash/script file that will just jest with `--config=path/to/config` or alternatively you can add the config option in the `getJestOptions` php function. diff --git a/packages/jest-validate/README.md b/packages/jest-validate/README.md index e1f091e139f7..a490975fe96f 100644 --- a/packages/jest-validate/README.md +++ b/packages/jest-validate/README.md @@ -60,12 +60,12 @@ Almost anything can be overwritten to suite your needs. ### Options -* `comment` – optional string to be rendered below error/warning message. -* `condition` – an optional function with validation condition. -* `deprecate`, `error`, `unknown` – optional functions responsible for displaying warning and error messages. -* `deprecatedConfig` – optional object with deprecated config keys. -* `exampleConfig` – the only **required** option with configuration against which you'd like to test. -* `title` – optional object of titles for errors and messages. +- `comment` – optional string to be rendered below error/warning message. +- `condition` – an optional function with validation condition. +- `deprecate`, `error`, `unknown` – optional functions responsible for displaying warning and error messages. +- `deprecatedConfig` – optional object with deprecated config keys. +- `exampleConfig` – the only **required** option with configuration against which you'd like to test. +- `title` – optional object of titles for errors and messages. You will find examples of `condition`, `deprecate`, `error`, `unknown`, and `deprecatedConfig` inside source of this repository, named respectively. diff --git a/packages/jest-worker/src/__performance_tests__/test.js b/packages/jest-worker/src/__performance_tests__/test.js index 5db9938889eb..16b824e9f97b 100644 --- a/packages/jest-worker/src/__performance_tests__/test.js +++ b/packages/jest-worker/src/__performance_tests__/test.js @@ -168,12 +168,12 @@ async function main() { console.log('-'.repeat(75)); console.log( `% improvement over ${calls} calls (global time):`, - 100 * (wFGT - jWGT) / wFGT, + (100 * (wFGT - jWGT)) / wFGT, ); console.log( `% improvement over ${calls} calls (processing time):`, - 100 * (wFPT - jWPT) / wFPT, + (100 * (wFPT - jWPT)) / wFPT, ); } diff --git a/packages/jest-worker/src/__performance_tests__/workers/pi.js b/packages/jest-worker/src/__performance_tests__/workers/pi.js index 76ffd79a4a3d..12c7ceee835d 100644 --- a/packages/jest-worker/src/__performance_tests__/workers/pi.js +++ b/packages/jest-worker/src/__performance_tests__/workers/pi.js @@ -10,5 +10,5 @@ module.exports = function() { } } - return 4 * inside / points; + return (4 * inside) / points; }; diff --git a/packages/jest/README.md b/packages/jest/README.md index b9a9b3e72799..8213f3605bf1 100644 --- a/packages/jest/README.md +++ b/packages/jest/README.md @@ -2,10 +2,10 @@ 🃏 Delightful JavaScript Testing -* **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. +- **👩🏻‍💻 Developer Ready**: Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. -* **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. +- **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. -* **📸 Snapshot Testing**: Jest can [capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. +- **📸 Snapshot Testing**: Jest can [capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. Read More: http://facebook.github.io/jest/ diff --git a/packages/pretty-format/README.md b/packages/pretty-format/README.md index 4c7de5b0fcb3..05c6799744be 100755 --- a/packages/pretty-format/README.md +++ b/packages/pretty-format/README.md @@ -2,17 +2,17 @@ > Stringify any JavaScript value. -* Supports all built-in JavaScript types - * primitive types: `Boolean`, `null`, `Number`, `String`, `Symbol`, `undefined` - * other non-collection types: `Date`, `Error`, `Function`, `RegExp` - * collection types: - * `arguments`, `Array`, `ArrayBuffer`, `DataView`, `Float32Array`, `Float64Array`, `Int8Array`, `Int16Array`, `Int32Array`, `Uint8Array`, `Uint8ClampedArray`, `Uint16Array`, `Uint32Array`, - * `Map`, `Set`, `WeakMap`, `WeakSet` - * `Object` -* [Blazingly fast](https://gist.github.com/thejameskyle/2b04ffe4941aafa8f970de077843a8fd) - * similar performance to `JSON.stringify` in v8 - * significantly faster than `util.format` in Node.js -* Serialize application-specific data types with built-in or user-defined plugins +- Supports all built-in JavaScript types + - primitive types: `Boolean`, `null`, `Number`, `String`, `Symbol`, `undefined` + - other non-collection types: `Date`, `Error`, `Function`, `RegExp` + - collection types: + - `arguments`, `Array`, `ArrayBuffer`, `DataView`, `Float32Array`, `Float64Array`, `Int8Array`, `Int16Array`, `Int32Array`, `Uint8Array`, `Uint8ClampedArray`, `Uint16Array`, `Uint32Array`, + - `Map`, `Set`, `WeakMap`, `WeakSet` + - `Object` +- [Blazingly fast](https://gist.github.com/thejameskyle/2b04ffe4941aafa8f970de077843a8fd) + - similar performance to `JSON.stringify` in v8 + - significantly faster than `util.format` in Node.js +- Serialize application-specific data types with built-in or user-defined plugins ## Installation @@ -102,8 +102,8 @@ const DEFAULT_THEME = { The `pretty-format` package provides some built-in plugins, including: -* `ReactElement` for elements from `react` -* `ReactTestComponent` for test objects from `react-test-renderer` +- `ReactElement` for elements from `react` +- `ReactTestComponent` for test objects from `react-test-renderer` ```js // CommonJS @@ -176,15 +176,15 @@ A plugin is a JavaScript object. If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either: -* `serialize(val, …)` method of the **improved** interface (available in **version 21** or later) -* `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method) +- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later) +- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method) ### test Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors: -* `TypeError: Cannot read property 'whatever' of null` -* `TypeError: Cannot read property 'whatever' of undefined` +- `TypeError: Cannot read property 'whatever' of null` +- `TypeError: Cannot read property 'whatever' of undefined` For example, `test` method of built-in `ReactElement` plugin: @@ -201,12 +201,12 @@ The **improved** interface is available in **version 21** or later. Write `serialize` to return a string, given the arguments: -* `val` which “passed the test” -* unchanging `config` object: derived from `options` -* current `indentation` string: concatenate to `indent` from `config` -* current `depth` number: compare to `maxDepth` from `config` -* current `refs` array: find circular references in objects -* `printer` callback function: serialize children +- `val` which “passed the test” +- unchanging `config` object: derived from `options` +- current `indentation` string: concatenate to `indent` from `config` +- current `depth` number: compare to `maxDepth` from `config` +- current `refs` array: find circular references in objects +- `printer` callback function: serialize children ### config @@ -225,13 +225,13 @@ Write `serialize` to return a string, given the arguments: Each property of `colors` in `config` corresponds to a property of `theme` in `options`: -* the key is the same (for example, `tag`) -* the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) Some properties in `config` are derived from `min` in `options`: -* `spacingInner` and `spacingOuter` are **newline** if `min` is `false` -* `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true` +- `spacingInner` and `spacingOuter` are **newline** if `min` is `false` +- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true` ### Example of serialize and test @@ -371,29 +371,29 @@ console.log( The **original** interface is adequate for plugins: -* that **do not** depend on options other than `highlight` or `min` -* that **do not** depend on `depth` or `refs` in recursive traversal, and -* if values either - * do **not** require indentation, or - * do **not** occur as children of JavaScript data structures (for example, array) +- that **do not** depend on options other than `highlight` or `min` +- that **do not** depend on `depth` or `refs` in recursive traversal, and +- if values either + - do **not** require indentation, or + - do **not** occur as children of JavaScript data structures (for example, array) Write `print` to return a string, given the arguments: -* `val` which “passed the test” -* current `printer(valChild)` callback function: serialize children -* current `indenter(lines)` callback function: indent lines at the next level -* unchanging `config` object: derived from `options` -* unchanging `colors` object: derived from `options` +- `val` which “passed the test” +- current `printer(valChild)` callback function: serialize children +- current `indenter(lines)` callback function: indent lines at the next level +- unchanging `config` object: derived from `options` +- unchanging `colors` object: derived from `options` The 3 properties of `config` are `min` in `options` and: -* `spacing` and `edgeSpacing` are **newline** if `min` is `false` -* `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true` +- `spacing` and `edgeSpacing` are **newline** if `min` is `false` +- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true` Each property of `colors` corresponds to a property of `theme` in `options`: -* the key is the same (for example, `tag`) -* the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) ### Example of print and test diff --git a/scripts/build.js b/scripts/build.js index d687b794def5..2a5f8b77aa91 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -49,6 +49,7 @@ const transformOptions = JSON.parse( transformOptions.babelrc = false; const prettierConfig = prettier.resolveConfig.sync(__filename); prettierConfig.trailingComma = 'none'; +prettierConfig.parser = 'babylon'; const adjustToTerminalWidth = str => { const columns = process.stdout.columns || 80; diff --git a/website/blog/2016-03-11-javascript-unit-testing-performance.md b/website/blog/2016-03-11-javascript-unit-testing-performance.md index 2f983fe375ff..11fe934d392d 100644 --- a/website/blog/2016-03-11-javascript-unit-testing-performance.md +++ b/website/blog/2016-03-11-javascript-unit-testing-performance.md @@ -13,9 +13,9 @@ As engineers added more and more tests though, we noticed the performance of Jes Jest is a bit different from most test runners. We designed it to work well in the context of Facebook's infrastructure: -* **Monorepo** At Facebook we have a huge monorepo that contains all of our JavaScript code. There are many reasons why this approach is advantageous for us and there is an [awesome talk](https://www.youtube.com/watch?v=W71BTkUbdqE) by a Google engineer that highlights all the benefits and drawbacks of monorepos. -* **Sandboxing** Another feature of Jest that's important to Facebook is how it virtualizes the test environment and wraps `require` in order to sandbox code execution and isolate individual tests. We're even working on making Jest more modular so we can take advantage of this functionality in other non-testing related use cases. -* **providesModule** If you've looked at any of our open source JavaScript projects before, you may have noticed that we use a `@providesModule` header to assign globally unique IDs to modules. This does require some custom tooling, but it allows us to reference modules without relative paths which has helped us move incredibly fast, has scaled well as our engineering organization has grown, and has fostered code sharing across the entire company. Check out [RelayContainer](https://github.com/facebook/relay/blob/4eae620d86ed7fce1ee463c2fca88eb690d9cbde/src/container/RelayContainer.js#L9) for an example of how this works in practice. One downside to this approach, though, is that we're forced to read and parse our entire JavaScript codebase in order to resolve a single require statement. This would obviously be prohibitively expensive without extensive caching, especially for a short-lived process like Jest. +- **Monorepo** At Facebook we have a huge monorepo that contains all of our JavaScript code. There are many reasons why this approach is advantageous for us and there is an [awesome talk](https://www.youtube.com/watch?v=W71BTkUbdqE) by a Google engineer that highlights all the benefits and drawbacks of monorepos. +- **Sandboxing** Another feature of Jest that's important to Facebook is how it virtualizes the test environment and wraps `require` in order to sandbox code execution and isolate individual tests. We're even working on making Jest more modular so we can take advantage of this functionality in other non-testing related use cases. +- **providesModule** If you've looked at any of our open source JavaScript projects before, you may have noticed that we use a `@providesModule` header to assign globally unique IDs to modules. This does require some custom tooling, but it allows us to reference modules without relative paths which has helped us move incredibly fast, has scaled well as our engineering organization has grown, and has fostered code sharing across the entire company. Check out [RelayContainer](https://github.com/facebook/relay/blob/4eae620d86ed7fce1ee463c2fca88eb690d9cbde/src/container/RelayContainer.js#L9) for an example of how this works in practice. One downside to this approach, though, is that we're forced to read and parse our entire JavaScript codebase in order to resolve a single require statement. This would obviously be prohibitively expensive without extensive caching, especially for a short-lived process like Jest. As a result of these unique constraints, Jest may never be able to be as fast as other test runners when running on our entire suite of tests. However, engineers rarely need to run Jest on our entire test suite. Powered by static analysis in the [node-haste](https://github.com/facebook/node-haste) project – we've been able to make the default mode for running Jest at Facebook `jest --onlyChanged`, or `jest -o`. In this mode we build a reverse dependency graph to find only the affected tests that need to be run based on the modules that have been changed. diff --git a/website/blog/2016-06-22-jest-13.md b/website/blog/2016-06-22-jest-13.md index 867d87bec318..ad0d08dccfbf 100644 --- a/website/blog/2016-06-22-jest-13.md +++ b/website/blog/2016-06-22-jest-13.md @@ -15,14 +15,14 @@ With the help of [lerna](https://github.com/lerna/lerna), we continued to modula ## New and improved features -* Added a notification plugin that shows a test run notification when using `--notify`. -* Added a `browser` config option to properly resolve npm packages with a browser field in `package.json` if you are writing tests for client side apps. -* Improved “no tests found message” which will now report which tests were found and how they were filtered. -* Added `jest.isMockFunction(jest.fn())` to test for mock functions. -* Improved test reporter printing and added a test failure summary when running many tests. -* Added support for mocking virtual modules through `jest.mock('Module', implementation, {virtual: true})`. -* Removed the `.haste_cache` folder. Jest now uses the operating system's preferred temporary file location. -* Added the duration of individual tests in verbose mode. -* Added the ability to record snapshots in Jest. We'll be publishing a separate blog post about this feature soon. +- Added a notification plugin that shows a test run notification when using `--notify`. +- Added a `browser` config option to properly resolve npm packages with a browser field in `package.json` if you are writing tests for client side apps. +- Improved “no tests found message” which will now report which tests were found and how they were filtered. +- Added `jest.isMockFunction(jest.fn())` to test for mock functions. +- Improved test reporter printing and added a test failure summary when running many tests. +- Added support for mocking virtual modules through `jest.mock('Module', implementation, {virtual: true})`. +- Removed the `.haste_cache` folder. Jest now uses the operating system's preferred temporary file location. +- Added the duration of individual tests in verbose mode. +- Added the ability to record snapshots in Jest. We'll be publishing a separate blog post about this feature soon. Finally, we have received a complete website redesign done by Matthew Johnston and added documentation for using [Jest with Webpack](http://facebook.github.io/jest/docs/tutorial-webpack.html#content). Happy Jesting! diff --git a/website/blog/2016-07-27-jest-14.md b/website/blog/2016-07-27-jest-14.md index ca28bedbd11c..5db822f74f6b 100644 --- a/website/blog/2016-07-27-jest-14.md +++ b/website/blog/2016-07-27-jest-14.md @@ -59,9 +59,9 @@ You can start using Jest with react-native by running `yarn add --dev jest-react } ``` -* [Tutorial and setup guide](/jest/docs/tutorial-react-native.html#content) -* [Example project](https://github.com/facebook/jest/tree/master/examples/react-native) -* [Example pull request for _snowflake_](https://github.com/bartonhammond/snowflake/pull/110), a popular react-native open source library. +- [Tutorial and setup guide](/jest/docs/tutorial-react-native.html#content) +- [Example project](https://github.com/facebook/jest/tree/master/examples/react-native) +- [Example pull request for _snowflake_](https://github.com/bartonhammond/snowflake/pull/110), a popular react-native open source library. _Note: the preset currently only implements the minimal set of configuration necessary to get started with React Native testing. We are hoping for community contributions to improve this project. Please try it and file [issues](https://github.com/facebook/jest/issues) or send pull requests!_ @@ -71,9 +71,9 @@ For Facebook's native apps we use a system called “snapshot testing”: a snap While this was the solution we wanted for the web, we also found many problems with such end-to-end tests that snapshot integration tests solve: -* **No flakiness:** Because tests are run in a command line runner instead of a real browser or on a real phone, the test runner doesn't have to wait for builds, spawn browsers, load a page and drive the UI to get a component into the expected state which tends to be flaky and the test results become noisy. -* **Fast iteration speed:** Engineers want to get results in less than a second rather than waiting for minutes or even hours. If tests don't run quickly like in most end-to-end frameworks, engineers don't run them at all or don't bother writing them in the first place. -* **Debugging:** It's easy to step into the code of an integration test in JS instead of trying to recreate the screenshot test scenario and debugging what happened in the visual diff. +- **No flakiness:** Because tests are run in a command line runner instead of a real browser or on a real phone, the test runner doesn't have to wait for builds, spawn browsers, load a page and drive the UI to get a component into the expected state which tends to be flaky and the test results become noisy. +- **Fast iteration speed:** Engineers want to get results in less than a second rather than waiting for minutes or even hours. If tests don't run quickly like in most end-to-end frameworks, engineers don't run them at all or don't bother writing them in the first place. +- **Debugging:** It's easy to step into the code of an integration test in JS instead of trying to recreate the screenshot test scenario and debugging what happened in the visual diff. Because we believe snapshot testing can be useful beyond Jest we split the feature into a [jest-snapshot](https://github.com/facebook/jest/tree/master/packages/jest-snapshot) package. We are happy to work with the community to make it more generic so it can be integrated with other test runners and share concepts and infrastructure with each other. @@ -85,10 +85,10 @@ Finally, here is a quote of a Facebook engineer describing how snapshot testing Recently [Aaron Abramov](https://twitter.com/aaronabramov_) has joined the Jest team full time to improve our unit and integration test infrastructure for Facebook's ads products. For the next few months the Jest team is planning major improvements in these areas: -* **Replace Jasmine:** Jasmine is slowing us down and is not being very actively developed. We started replacing all the Jasmine matchers and are excited to add new features and drop this dependency. -* **Code Coverage:** When Jest was originally created, tools such as babel didn't exist. Our code coverage support has a bunch of edge cases and isn't always working properly. We are rewriting it to address all the current problems with coverage. -* **Developer Experience:** This ranges from improving the setup process, the debugging experience to CLI improvements and more documentation. -* **Mocking:** The mocking system, especially around manual mocks, is not working well and is confusing. We hope to make it more strict and easier to understand. -* **Performance:** Further performance improvements especially for really large codebases are being worked on. +- **Replace Jasmine:** Jasmine is slowing us down and is not being very actively developed. We started replacing all the Jasmine matchers and are excited to add new features and drop this dependency. +- **Code Coverage:** When Jest was originally created, tools such as babel didn't exist. Our code coverage support has a bunch of edge cases and isn't always working properly. We are rewriting it to address all the current problems with coverage. +- **Developer Experience:** This ranges from improving the setup process, the debugging experience to CLI improvements and more documentation. +- **Mocking:** The mocking system, especially around manual mocks, is not working well and is confusing. We hope to make it more strict and easier to understand. +- **Performance:** Further performance improvements especially for really large codebases are being worked on. As always, if you have questions or if you are excited to help out, please reach out to us! diff --git a/website/blog/2016-09-01-jest-15.md b/website/blog/2016-09-01-jest-15.md index d9efe72d1d41..de936a5e05c7 100644 --- a/website/blog/2016-09-01-jest-15.md +++ b/website/blog/2016-09-01-jest-15.md @@ -92,15 +92,15 @@ Code coverage in Jest can be used through `jest --coverage` and requires no addi A huge number of other improvements were also made: -* Improved performance of small test runs. -* Jest now uses verbose mode when only a single test file is executed. -* Added an `--env` option to override the configured test environment. -* `moduleNameMapper` now uses a resolution algorithm. -* Jest now works with paths that have special characters in them, like parenthesis. -* Added `global.global` to the node environment. -* Fixed `babel-plugin-jest-hoist`'s invalid error when a random user function was called `mock`. -* Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module collision when using `jsdom` as test environment. -* Improvements to Jest's own test infra by merging integration and unit tests. Code coverage is now collected for Jest. +- Improved performance of small test runs. +- Jest now uses verbose mode when only a single test file is executed. +- Added an `--env` option to override the configured test environment. +- `moduleNameMapper` now uses a resolution algorithm. +- Jest now works with paths that have special characters in them, like parenthesis. +- Added `global.global` to the node environment. +- Fixed `babel-plugin-jest-hoist`'s invalid error when a random user function was called `mock`. +- Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module collision when using `jsdom` as test environment. +- Improvements to Jest's own test infra by merging integration and unit tests. Code coverage is now collected for Jest. We are happy when looking back at all the changes we have made together with the help from the community and couldn't be more excited to make Jest even better over the course of the next few months. Please [file an issue](https://github.com/facebook/jest/issues) if something isn't working as expected and send us pull requests. diff --git a/website/blog/2016-10-03-jest-16.md b/website/blog/2016-10-03-jest-16.md index db189b992540..11387c9c9d0f 100644 --- a/website/blog/2016-10-03-jest-16.md +++ b/website/blog/2016-10-03-jest-16.md @@ -17,16 +17,16 @@ Jest 16 features a new reporter interface that shows running tests as well as a We also added a lot of new features which you may find useful: -* New CLI flags were added: A `--testNamePattern=pattern` or `-t ` option was added to filter tests from the command line much like `it.only` or `fit` does in tests. -* Previously failed tests now always run first. -* `jest ` is now case-insensitive to make it easier to filter test files. -* A test run in watch mode can now be interrupted. During a test run, simply press any of the keys used for input during watch mode (`a`, `o`, `p`, `q` or `enter`) to abort a test run and start a new one. -* The `--bail` flag now also works in watch mode. Together with running failed tests first, Jest's watch mode will now feel turbocharged! -* Jest now automatically considers files and tests with the `jsx` extension. -* Jest warns about duplicate manual mock files and we improved automatically created mocks for ES modules compiled with babel. -* A `jest.clearAllMocks` function was added to clear all mocks in between tests. -* We improved module resolution when `moduleNameMapper` is used. -* Finally, a `--findRelatedTests ` cli option was added to run tests related to the specified files. This is especially helpful as a pre-commit hook if you'd like to run tests only on a specified set of files that have tests associated with them. +- New CLI flags were added: A `--testNamePattern=pattern` or `-t ` option was added to filter tests from the command line much like `it.only` or `fit` does in tests. +- Previously failed tests now always run first. +- `jest ` is now case-insensitive to make it easier to filter test files. +- A test run in watch mode can now be interrupted. During a test run, simply press any of the keys used for input during watch mode (`a`, `o`, `p`, `q` or `enter`) to abort a test run and start a new one. +- The `--bail` flag now also works in watch mode. Together with running failed tests first, Jest's watch mode will now feel turbocharged! +- Jest now automatically considers files and tests with the `jsx` extension. +- Jest warns about duplicate manual mock files and we improved automatically created mocks for ES modules compiled with babel. +- A `jest.clearAllMocks` function was added to clear all mocks in between tests. +- We improved module resolution when `moduleNameMapper` is used. +- Finally, a `--findRelatedTests ` cli option was added to run tests related to the specified files. This is especially helpful as a pre-commit hook if you'd like to run tests only on a specified set of files that have tests associated with them. This is what Jest looks like when a test run is interrupted in watch mode: ![watch](/jest/img/blog/16-watch.gif) @@ -34,9 +34,9 @@ This is what Jest looks like when a test run is interrupted in watch mode: ![wat Jest's snapshot implementation was completely rewritten. The new version of the `jest-snapshot` package is now structured in a way that allows for easier integration into other test runners and enables more cool integrations like with [React Storybook](https://voice.kadira.io/snapshot-testing-in-react-storybook-43b3b71cec4f#.qh4lzcadb). Jest doesn't mark snapshots as obsolete in a file with skipped or failing tests. We also made a number of changes to the snapshot format: -* Objects and Arrays are now printed with a trailing comma to minimize future changes to snapshots. -* We removed function names from snapshots. They were causing issues with different versions of Node, with code coverage instrumentation and we generally felt like it wasn't useful signal to show to the user that the name of a function has changed. -* Snapshots are now sorted using natural sort order within a file. +- Objects and Arrays are now printed with a trailing comma to minimize future changes to snapshots. +- We removed function names from snapshots. They were causing issues with different versions of Node, with code coverage instrumentation and we generally felt like it wasn't useful signal to show to the user that the name of a function has changed. +- Snapshots are now sorted using natural sort order within a file. When upgrading to Jest 16, the diff might look similar to this one: ![snapshots](/jest/img/blog/16-snapshots.png) @@ -52,8 +52,8 @@ Finally, if you'd like to overwrite the `expect` global with a different asserti Over the last month lots of articles were written about Jest's snapshot testing feature, how to migrate to Jest and how to get started writing tests. I also did a few live videos to explain how Jest and snapshot testing works: -* [FB Live Video about Snapshot Testing](https://www.facebook.com/react/videos/1035427199869020/). -* [JavaScript & React Testing with Kent C. Dodds](https://www.youtube.com/watch?v=i31VtyJSM-I&feature=youtu.be). +- [FB Live Video about Snapshot Testing](https://www.facebook.com/react/videos/1035427199869020/). +- [JavaScript & React Testing with Kent C. Dodds](https://www.youtube.com/watch?v=i31VtyJSM-I&feature=youtu.be). A number of people wrote articles about snapshot testing. The most opinionated article that resonated with the Jest team was “[Testing with Jest Snapshots: First Impressions](http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/)”. Ben makes three great points in his blog post: @@ -65,12 +65,12 @@ We highly recommend reading the entire blog post. Ben did a fantastic job explai Other highlights about snapshot testing: -* A React Native testing series: [Part 1: Jest – Snapshot come into play](https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-i-snapshots-come-into-play-68ba19b1b9fe) and [Part 2: Jest – Redux Snapshots for your Actions and Reducers](https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-ii-redux-snapshots-for-your-actions-and-reducers-8559f6f8050b#.putt9eipm). -* [How we landed on Jest snapshot testing for JavaScript](https://blog.grommet.io/post/2016/09/01/how-we-landed-on-jest-snapshot-testing-for-javascript). -* [Picture This: Snapshot Testing](http://guigrpa.github.io/2016/09/27/picture-this-snapshot-testing/). -* [Snapshot testing with React Storybook](https://voice.kadira.io/snapshot-testing-in-react-storybook-43b3b71cec4f). -* [Testing React and Redux Applications](https://medium.com/@ryancollinsio/testing-react-redux-applications-fee79ac0087f#.lyjl7st1n). -* If you are using the popular [enzyme](https://github.com/airbnb/enzyme) testing utility, there is now a project [enzyme-to-json](https://github.com/trayio/enzyme-to-json) which makes it possible to use Jest's snapshot testing feature together with enzyme. +- A React Native testing series: [Part 1: Jest – Snapshot come into play](https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-i-snapshots-come-into-play-68ba19b1b9fe) and [Part 2: Jest – Redux Snapshots for your Actions and Reducers](https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-ii-redux-snapshots-for-your-actions-and-reducers-8559f6f8050b#.putt9eipm). +- [How we landed on Jest snapshot testing for JavaScript](https://blog.grommet.io/post/2016/09/01/how-we-landed-on-jest-snapshot-testing-for-javascript). +- [Picture This: Snapshot Testing](http://guigrpa.github.io/2016/09/27/picture-this-snapshot-testing/). +- [Snapshot testing with React Storybook](https://voice.kadira.io/snapshot-testing-in-react-storybook-43b3b71cec4f). +- [Testing React and Redux Applications](https://medium.com/@ryancollinsio/testing-react-redux-applications-fee79ac0087f#.lyjl7st1n). +- If you are using the popular [enzyme](https://github.com/airbnb/enzyme) testing utility, there is now a project [enzyme-to-json](https://github.com/trayio/enzyme-to-json) which makes it possible to use Jest's snapshot testing feature together with enzyme. [Redux itself now uses Jest](https://github.com/reactjs/redux/commit/7296d3cba1f5f899bdee5ef6695a8d21149f8d6c) and Max Stoiber wrote a [tutorial on how to test code written with redux](http://academy.plot.ly/react/6-testing/). There is also a great [guide on how to write tests for MobX](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest). If you are using [create-react-app](https://github.com/facebookincubator/create-react-app), Jest is now included by default. Kent C. Dodds created a ton of [videos on egghead.io](https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074) that will help you get started with Jest. diff --git a/website/blog/2016-12-15-2016-in-jest.md b/website/blog/2016-12-15-2016-in-jest.md index 9068659c92c8..e91dad75c2c7 100644 --- a/website/blog/2016-12-15-2016-in-jest.md +++ b/website/blog/2016-12-15-2016-in-jest.md @@ -29,80 +29,80 @@ We feel incredibly humbled that 100+ companies [have adopted Jest](https://twitt Here is what happened in the community in the last two months: -* Jason Bonta and Dmitrii Abramov [redefined the “testing pyramid”](https://twitter.com/abramov_dmitrii/status/805913874704674816) we were talking a lot about at Facebook. -* [jest-codemods](https://github.com/skovhus/jest-codemods#jest-codemods) now allows you to painlessly migrate from Mocha, Tape and Ava to Jest. -* The React team announced [improvements to the react-test-renderer](https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html) in 15.4.0. -* Orta Therox build an amazing [vscode-jest integration](https://github.com/orta/vscode-jest#the-aim) and donated the code for editor support to Jest. -* Pavithra Kodmad is documenting [Flipkarts adoption of Jest](http://pksjce.github.io/2016/12/08/notes-on-jest) and shares some getting started tips. -* Kent C. Dodds wrote about [migrating to Jest at Paypal](https://medium.com/@kentcdodds/migrating-to-jest-881f75366e7e#.ticf0wchu) and Jason Brown [wrote about migrating to Jest as well](http://browniefed.com/blog/migrating-ava-to-jest/). -* Ben McCormick wrote about [saving time with Jest](http://benmccormick.org/2016/12/10/saving-time-with-jest/). -* Eric Clemmons wrote about [snapshots and storybook integration](https://medium.com/@ericclemmons/jest-snapshots-for-storybook-5bf36b5e5a3a). -* Edvin Erikson wrote about [getting Tap output in Jest](https://medium.com/@edvinerikson/getting-jest-output-in-tap-format-6e07dc2c484c#.1l4edixhl). -* [jest-html](https://github.com/guigrpa/jest-html#jest-html--) can bring snapshot diffing to your browser. -* There were a few [great conversations on hackernews](https://news.ycombinator.com/item?id=13128146) about Jest. -* The community started a great discussion about the [future of enzyme](https://github.com/airbnb/enzyme/issues/715). -* Ruben Oostinga wrote about [combining chai and Jest matchers](https://medium.com/@RubenOostinga/combining-chai-and-jest-matchers-d12d1ffd0303#.87si0ra2h). -* Emil Ong wrote about why [“TDD'ing your frontend seems pointless”](https://engineering.haus.com/why-tdding-your-frontend-feels-pointless-5f710fea7325#.pql79knnm). -* Nate Hunzaker wrote about [end-to-end testing with Jest and Nightmare](https://www.viget.com/articles/acceptance-testing-react-apps-with-jest-and-nightmare). -* [Using Jest with Angular just works](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251#.h9badqevy) according to Matthieu Lux. -* A fantastic conversation about the [purpose of snapshot testing](https://github.com/facebook/jest/issues/2197) is happening right now. -* Dmitrii made a new [music video with his metal band](https://twitter.com/abramov_dmitrii/status/806613542447157248). -* [lazyspec](https://yarnpkg.com/en/package/lazyspec) can help you create smoke tests quickly if you are introducing tests to an existing codebase. -* Patrick Stapfer did a lightning talk about [vim and Jest](https://twitter.com/ryyppy/status/803871975995277312). -* Mark Dalgleish was [commenting on the value of snapshot testing](https://twitter.com/markdalgleish/status/806608159527747584). +- Jason Bonta and Dmitrii Abramov [redefined the “testing pyramid”](https://twitter.com/abramov_dmitrii/status/805913874704674816) we were talking a lot about at Facebook. +- [jest-codemods](https://github.com/skovhus/jest-codemods#jest-codemods) now allows you to painlessly migrate from Mocha, Tape and Ava to Jest. +- The React team announced [improvements to the react-test-renderer](https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html) in 15.4.0. +- Orta Therox build an amazing [vscode-jest integration](https://github.com/orta/vscode-jest#the-aim) and donated the code for editor support to Jest. +- Pavithra Kodmad is documenting [Flipkarts adoption of Jest](http://pksjce.github.io/2016/12/08/notes-on-jest) and shares some getting started tips. +- Kent C. Dodds wrote about [migrating to Jest at Paypal](https://medium.com/@kentcdodds/migrating-to-jest-881f75366e7e#.ticf0wchu) and Jason Brown [wrote about migrating to Jest as well](http://browniefed.com/blog/migrating-ava-to-jest/). +- Ben McCormick wrote about [saving time with Jest](http://benmccormick.org/2016/12/10/saving-time-with-jest/). +- Eric Clemmons wrote about [snapshots and storybook integration](https://medium.com/@ericclemmons/jest-snapshots-for-storybook-5bf36b5e5a3a). +- Edvin Erikson wrote about [getting Tap output in Jest](https://medium.com/@edvinerikson/getting-jest-output-in-tap-format-6e07dc2c484c#.1l4edixhl). +- [jest-html](https://github.com/guigrpa/jest-html#jest-html--) can bring snapshot diffing to your browser. +- There were a few [great conversations on hackernews](https://news.ycombinator.com/item?id=13128146) about Jest. +- The community started a great discussion about the [future of enzyme](https://github.com/airbnb/enzyme/issues/715). +- Ruben Oostinga wrote about [combining chai and Jest matchers](https://medium.com/@RubenOostinga/combining-chai-and-jest-matchers-d12d1ffd0303#.87si0ra2h). +- Emil Ong wrote about why [“TDD'ing your frontend seems pointless”](https://engineering.haus.com/why-tdding-your-frontend-feels-pointless-5f710fea7325#.pql79knnm). +- Nate Hunzaker wrote about [end-to-end testing with Jest and Nightmare](https://www.viget.com/articles/acceptance-testing-react-apps-with-jest-and-nightmare). +- [Using Jest with Angular just works](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251#.h9badqevy) according to Matthieu Lux. +- A fantastic conversation about the [purpose of snapshot testing](https://github.com/facebook/jest/issues/2197) is happening right now. +- Dmitrii made a new [music video with his metal band](https://twitter.com/abramov_dmitrii/status/806613542447157248). +- [lazyspec](https://yarnpkg.com/en/package/lazyspec) can help you create smoke tests quickly if you are introducing tests to an existing codebase. +- Patrick Stapfer did a lightning talk about [vim and Jest](https://twitter.com/ryyppy/status/803871975995277312). +- Mark Dalgleish was [commenting on the value of snapshot testing](https://twitter.com/markdalgleish/status/806608159527747584). ## New features, changes and fixes in Jest 17 & 18 Jest was initially created more than five years ago and as such an old framework it has accumulated some technical debt. This is why we tend to make breaking changes more often than may seem necessary: We believe it is important to incrementally reduce technical debt to ensure that Jest as a project stays maintainable long-term. We didn't announce Jest 17 in a blog post and if you haven't upgraded to it in the last month you may find the [changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md) useful. -* **Breaking:** Removed `pit` in favor of `it` or `test` and `mockImpl` in favor of `jest.fn()` or `mockImplementation` . -* **Breaking:** Renamed `--jsonOutputFile` to `--outputFile`. -* **Breaking:** Updated `testRegex` to include `test.js` and `spec.js` files. -* **Breaking:** Replaced `scriptPreprocessor` with the new `transform` option. -* **Breaking:** The `testResultsProcessor` function is now required to return the modified results. -* **Potentially Breaking:** Properly resolve `snapshotSerializers`, `setupFiles`, `transform`, `testRunner` and `testResultsProcessor` with a resolution algorithm instead of using `path.resolve`. This mainly means that `` is no longer needed for these options. -* **Added: **`pretty-format` and `jest-editor-support` were merged into Jest. -* **Added:** `expect.any`, `expect.anything`, `expect.objectContaining`, `expect.arrayContaining`, `expect.stringMatching`. -* **Added: **`--testResultsProcessor` is now exposed through the cli. -* **Added:** Implemented file watching in `jest-haste-map`. -* **Added:** Usage of Jest in watch mode can be hidden through `JEST_HIDE_USAGE`. -* **Added:** `expect.assertions(number)` which will ensure that a specified amount of assertions is made in one test. -* **Added: **`.toMatchSnapshot(?string)` feature to give snapshots a name. -* **Added: **`toMatchObject`, `toHaveProperty` , `toHaveLength` matchers. -* **Added:** `expect.extend`. -* **Added:** Added support for custom snapshots serializers. -* **Added:** Big diffs are now collapsed by default in snapshots and assertions. Added `--expand` (or `-e`) to show the full diff. -* **Added:** `jest.resetAllMocks` which replaces `jest.clearAllMocks`. -* **Added: **`--json` now includes information about individual tests inside a file. -* **Fixed: **`test.concurrent` unhandled promise rejections. -* **Fixed:** `babel-plugin-jest-hoist` when using `jest.mock` with three arguments. -* **Fixed:** The `JSON` global in `jest-environment-node` now comes from the vm context instead of the parent context. -* **Fixed:** Jest does not print stack traces from babel any longer. -* **Fixed:** Fake timers are reset when `FakeTimers.useTimers()` is called. -* **Fixed:** Regular expressions are properly escaped in snapshots. -* **Fixed:** Improved pretty printing of large objects. -* **Fixed:** `NaN% Failed` in the OS notification when using `--notify`. -* **Fixed:** The first test run without cached timings will now use separate processes instead of running in band. -* **Fixed:** `Map`/`Set` comparisons. -* **Fixed: **`test.concurrent` now works with `--testNamePattern`. -* **Fixed:** Improved `.toContain` matcher. -* **Fixed:** Properly resolve modules with platform extensions on react-native. -* **Fixed:** global built in objects in `jest-environment-node` now work properly. -* **Fixed:** Create mock objects in the vm context instead of the parent context. -* **Fixed: **`.babelrc` is now part of the transform cache key in `babel-jest`. -* **Fixed:** docblock parsing with haste modules. -* **Fixed:** Exit with the proper code when the coverage threshold is not reached. -* **Fixed: **Jest now clears the entire scrollback in watch mode. -* **Deprecated: **`jest-react-native` was deprecated and now forwards `react-native`. +- **Breaking:** Removed `pit` in favor of `it` or `test` and `mockImpl` in favor of `jest.fn()` or `mockImplementation` . +- **Breaking:** Renamed `--jsonOutputFile` to `--outputFile`. +- **Breaking:** Updated `testRegex` to include `test.js` and `spec.js` files. +- **Breaking:** Replaced `scriptPreprocessor` with the new `transform` option. +- **Breaking:** The `testResultsProcessor` function is now required to return the modified results. +- **Potentially Breaking:** Properly resolve `snapshotSerializers`, `setupFiles`, `transform`, `testRunner` and `testResultsProcessor` with a resolution algorithm instead of using `path.resolve`. This mainly means that `` is no longer needed for these options. +- **Added: **`pretty-format` and `jest-editor-support` were merged into Jest. +- **Added:** `expect.any`, `expect.anything`, `expect.objectContaining`, `expect.arrayContaining`, `expect.stringMatching`. +- **Added: **`--testResultsProcessor` is now exposed through the cli. +- **Added:** Implemented file watching in `jest-haste-map`. +- **Added:** Usage of Jest in watch mode can be hidden through `JEST_HIDE_USAGE`. +- **Added:** `expect.assertions(number)` which will ensure that a specified amount of assertions is made in one test. +- **Added: **`.toMatchSnapshot(?string)` feature to give snapshots a name. +- **Added: **`toMatchObject`, `toHaveProperty` , `toHaveLength` matchers. +- **Added:** `expect.extend`. +- **Added:** Added support for custom snapshots serializers. +- **Added:** Big diffs are now collapsed by default in snapshots and assertions. Added `--expand` (or `-e`) to show the full diff. +- **Added:** `jest.resetAllMocks` which replaces `jest.clearAllMocks`. +- **Added: **`--json` now includes information about individual tests inside a file. +- **Fixed: **`test.concurrent` unhandled promise rejections. +- **Fixed:** `babel-plugin-jest-hoist` when using `jest.mock` with three arguments. +- **Fixed:** The `JSON` global in `jest-environment-node` now comes from the vm context instead of the parent context. +- **Fixed:** Jest does not print stack traces from babel any longer. +- **Fixed:** Fake timers are reset when `FakeTimers.useTimers()` is called. +- **Fixed:** Regular expressions are properly escaped in snapshots. +- **Fixed:** Improved pretty printing of large objects. +- **Fixed:** `NaN% Failed` in the OS notification when using `--notify`. +- **Fixed:** The first test run without cached timings will now use separate processes instead of running in band. +- **Fixed:** `Map`/`Set` comparisons. +- **Fixed: **`test.concurrent` now works with `--testNamePattern`. +- **Fixed:** Improved `.toContain` matcher. +- **Fixed:** Properly resolve modules with platform extensions on react-native. +- **Fixed:** global built in objects in `jest-environment-node` now work properly. +- **Fixed:** Create mock objects in the vm context instead of the parent context. +- **Fixed: **`.babelrc` is now part of the transform cache key in `babel-jest`. +- **Fixed:** docblock parsing with haste modules. +- **Fixed:** Exit with the proper code when the coverage threshold is not reached. +- **Fixed: **Jest now clears the entire scrollback in watch mode. +- **Deprecated: **`jest-react-native` was deprecated and now forwards `react-native`. ## Plans for Jest in H1 2017 Six months ago [we shared our plans for Jest](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html#what-s-next-for-jest) and we are happy that we were able to execute well on almost all of them. For the next six months, here is what we are planning: -* **Instant feedback:** [Nuclide](https://nuclide.io/) integration and an improved and [faster watch mode](https://github.com/facebook/jest/pull/2324#issuecomment-267149669). -* **Improved developer experience:** new mocking APIs and improved assertions. -* **Better performance and memory usage:** analyze Jest and be more conscious about efficiency. -* **Snapshot Improvements: **snapshot approval mode, syntax highlighting and improved `react-test-renderer` APIs. -* **Website:** We'll overhaul the website and documentation and add a Jest cheat sheet. +- **Instant feedback:** [Nuclide](https://nuclide.io/) integration and an improved and [faster watch mode](https://github.com/facebook/jest/pull/2324#issuecomment-267149669). +- **Improved developer experience:** new mocking APIs and improved assertions. +- **Better performance and memory usage:** analyze Jest and be more conscious about efficiency. +- **Snapshot Improvements: **snapshot approval mode, syntax highlighting and improved `react-test-renderer` APIs. +- **Website:** We'll overhaul the website and documentation and add a Jest cheat sheet. We won't be providing timelines or estimates for these features and we may not actually get to all of these things. If you'd like to help make these things a reality, send us issues and pull requests with your ideas and let's work on improving Jest together in 2017. diff --git a/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md b/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md index 85f3e9d69e54..ca5c5342609c 100644 --- a/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md +++ b/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md @@ -17,9 +17,9 @@ We [completely rewrote the watch mode](https://github.com/facebook/jest/pull/236 We made a couple of changes to the snapshot format. We don't make changes like this often and only consider them if they actually improve how snapshots work. As well as introducing a snapshot version number we accumulated a number of changes we wanted to make to the format for a while: -* We dropped the “test” prefix in snapshot names from top level `test` or `it` calls. -* We improved the printing of React elements to cause less changes when the last prop in an element changes. -* We improved the character escaping mechanism to be more bulletproof. +- We dropped the “test” prefix in snapshot names from top level `test` or `it` calls. +- We improved the printing of React elements to cause less changes when the last prop in an element changes. +- We improved the character escaping mechanism to be more bulletproof. Before: @@ -68,8 +68,8 @@ Skipped tests are now printed as a single line instead of showing every individu Jest 19 ships with two new coverage-related arguments which you can run from CLI: -* `--collectCoverageFrom` -* `--coverageDirectory` +- `--collectCoverageFrom` +- `--coverageDirectory` We now also error on invalid CLI arguments instead of ignoring them. But we've got your back with helpful error message like the one below, e.g. when you try running `jest --watc`: @@ -77,9 +77,9 @@ We now also error on invalid CLI arguments instead of ignoring them. But we've g ## `expect` Improvements -* [`expect.addSnapshotSerializer`](/jest/docs/expect.html#expectaddsnapshotserializerserializer) -* [`expect.stringContaining`](/jest/docs/expect.html#expectstringcontainingstring) -* [`jest.spyOn`](/jest/docs/jest-object.html#jestspyonobject-methodname) +- [`expect.addSnapshotSerializer`](/jest/docs/expect.html#expectaddsnapshotserializerserializer) +- [`expect.stringContaining`](/jest/docs/expect.html#expectstringcontainingstring) +- [`jest.spyOn`](/jest/docs/jest-object.html#jestspyonobject-methodname) We're close to almost full feature parity with the `expect` npm package. [Michael Jackson](https://twitter.com/mjackson), the author of the package, agreed to [donate](https://github.com/facebook/jest/issues/1679) it to the Jest project, which means that `jest-matchers` will be renamed to `expect`. Since our version of `expect` is not intended to be fully compatible, [Christopher Chedeau](https://twitter.com/Vjeux) is working on a codemod to make the transition painless. Christopher also worked on a number of improvements to `jest-matchers` which enables it to be used outside of Jest and even [works inside browsers](https://github.com/facebook/jest/pull/2795). @@ -87,9 +87,9 @@ We're close to almost full feature parity with the `expect` npm package. [Michae Thanks to [Jonathan Kim](https://twitter.com/jonnykim) Jest finally has its own official ESLint plugin. It exposes three rules: -* [no-disabled-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - this rule prevents you from accidentally committing disabled tests. -* [no-focused-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - this rule prevents you from committing focused tests which would disable all other tests in the same suite. -* [no-identical-title](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallows identical titles in test names. +- [no-disabled-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - this rule prevents you from accidentally committing disabled tests. +- [no-focused-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - this rule prevents you from committing focused tests which would disable all other tests in the same suite. +- [no-identical-title](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallows identical titles in test names. You can install it using `npm install --save-dev eslint-plugin-jest` or `yarn add --dev eslint eslint-plugin-jest` and it can be enabled by adding `{"plugins": ["jest"]}` to your eslint configuration. @@ -121,23 +121,23 @@ As a part of our cleanups and fixes we removed the `mocksPattern` configuration As you may have already seen, [Hector Ramos](https://twitter.com/hectorramos) and [Kevin Lacker](https://twitter.com/lacker) gave Jest's documentation a fresh new look. We changed the way we organize the website and it now features Docs and API as separate pages: -* Under [Docs](https://facebook.github.io/jest/docs/getting-started.html#content) you can find an introduction to Jest, including [Getting Started](https://facebook.github.io/jest/docs/getting-started.html#content) or [Testing Asynchronous Code](https://facebook.github.io/jest/docs/asynchronous.html#content) and handy guides like [Snapshot Testing](https://facebook.github.io/jest/docs/snapshot-testing.html#content), [Testing React Native App](https://facebook.github.io/jest/docs/tutorial-react-native.html#content), [Using with webpack](https://facebook.github.io/jest/docs/webpack.html#content) or [Migrating to Jest](https://facebook.github.io/jest/docs/migration-guide.html#content) and many more! -* The [API](https://facebook.github.io/jest/docs/api.html) section on the other hand lists all available methods exposed by Jest: the `expect` and `jest` objects, mock functions, globals, along with configuration options from _package.json_ and from the CLI. +- Under [Docs](https://facebook.github.io/jest/docs/getting-started.html#content) you can find an introduction to Jest, including [Getting Started](https://facebook.github.io/jest/docs/getting-started.html#content) or [Testing Asynchronous Code](https://facebook.github.io/jest/docs/asynchronous.html#content) and handy guides like [Snapshot Testing](https://facebook.github.io/jest/docs/snapshot-testing.html#content), [Testing React Native App](https://facebook.github.io/jest/docs/tutorial-react-native.html#content), [Using with webpack](https://facebook.github.io/jest/docs/webpack.html#content) or [Migrating to Jest](https://facebook.github.io/jest/docs/migration-guide.html#content) and many more! +- The [API](https://facebook.github.io/jest/docs/api.html) section on the other hand lists all available methods exposed by Jest: the `expect` and `jest` objects, mock functions, globals, along with configuration options from _package.json_ and from the CLI. The homepage was completely redesigned to be more descriptive of what Jest is about: “_Zero configuration testing platform_”. We also made sure it reads better on mobile devices. And for those using RSS – we finally provide a [feed for our blog](http://facebook.github.io/jest/blog/feed.xml). ## Community Updates -* We really loved this talk: “[Introduction to Jest](https://www.youtube.com/watch?v=tvy0bSgwtTo)“ by Vas Boroviak. -* Follow [@fbjest on Twitter](http://twitter.com/fbjest). -* The Jest Core team syncs once a week to discuss current and future issues. If you'd like to work on Jest, let us know, submit a few pull requests and join our weekly team meetings. -* The awesome engineers at Artsy wrote [about Jest as part of their 2017 frontend stack](http://artsy.github.io/blog/2017/02/05/Front-end-JavaScript-at-Artsy-2017/). -* Stephen Scott wrote a detailed article about [testing React components](https://medium.freecodecamp.com/the-right-way-to-test-react-components-548a4736ab22) in which he weighs the pros and cons of different approaches. -* [Using Jest with vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.r8ryxlw98) got a lot easier after reading Cristian Carlesso's blog post. -* [Michele Bertoli wrote a book about React Design Patterns and Best Practices](https://twitter.com/cpojer/status/825004258219130880) which features an entire section about Jest. -* Improved `--notify` command that shows an operating system notification which [can now also re-run tests from the notification](https://github.com/facebook/jest/pull/2727). This is actually a Jest feature and we are just checking if you are still reading this blog post. -* Jest is now part of [react-boilerplate](https://twitter.com/mxstbr/status/820326656439177217). -* Read about the [hidden powers of Jest's matchers](https://medium.com/@boriscoder/the-hidden-power-of-jest-matchers-f3d86d8101b0#.pn10z1pzx). +- We really loved this talk: “[Introduction to Jest](https://www.youtube.com/watch?v=tvy0bSgwtTo)“ by Vas Boroviak. +- Follow [@fbjest on Twitter](http://twitter.com/fbjest). +- The Jest Core team syncs once a week to discuss current and future issues. If you'd like to work on Jest, let us know, submit a few pull requests and join our weekly team meetings. +- The awesome engineers at Artsy wrote [about Jest as part of their 2017 frontend stack](http://artsy.github.io/blog/2017/02/05/Front-end-JavaScript-at-Artsy-2017/). +- Stephen Scott wrote a detailed article about [testing React components](https://medium.freecodecamp.com/the-right-way-to-test-react-components-548a4736ab22) in which he weighs the pros and cons of different approaches. +- [Using Jest with vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.r8ryxlw98) got a lot easier after reading Cristian Carlesso's blog post. +- [Michele Bertoli wrote a book about React Design Patterns and Best Practices](https://twitter.com/cpojer/status/825004258219130880) which features an entire section about Jest. +- Improved `--notify` command that shows an operating system notification which [can now also re-run tests from the notification](https://github.com/facebook/jest/pull/2727). This is actually a Jest feature and we are just checking if you are still reading this blog post. +- Jest is now part of [react-boilerplate](https://twitter.com/mxstbr/status/820326656439177217). +- Read about the [hidden powers of Jest's matchers](https://medium.com/@boriscoder/the-hidden-power-of-jest-matchers-f3d86d8101b0#.pn10z1pzx). Finally, we are happy to announce that the [ava](https://github.com/avajs/ava) test runner has adopted parts of the Jest platform and is now shipping with basic [snapshot support](https://github.com/avajs/ava#snapshot-testing) and is using [pretty-format](https://github.com/facebook/jest/tree/master/packages/pretty-format). Consolidating test infrastructure makes it easier to learn how to test applications and enables us to share best practices. We are looking forward to see what we can learn from existing test libraries in the future. diff --git a/website/blog/2017-05-06-jest-20-delightful-testing-multi-project-runner.md b/website/blog/2017-05-06-jest-20-delightful-testing-multi-project-runner.md index a5e1218ff6f2..a4d3294c6451 100644 --- a/website/blog/2017-05-06-jest-20-delightful-testing-multi-project-runner.md +++ b/website/blog/2017-05-06-jest-20-delightful-testing-multi-project-runner.md @@ -36,11 +36,11 @@ Finally, we are now properly mapping code coverage when using TypeScript and we We made a number of additions and improvements to the testing APIs which will help write more effective tests. We'd like to point out that all of these improvements were made entirely by community members! -* **Better async testing:** Added new async/Promise support through resolves/rejects modifiers on expect: `expect(Promise(…)).resolves.toEqual(…)`. [See documentation](https://facebook.github.io/jest/docs/en/expect.html#resolves). -* **Expect assertions:** Along with the existing `expect.assertions(n)`, the new `expect.hasAssertions()` can be used to ensure a test has at least one assertion. -* **Lint Plugin:** A `valid-expect` rule was added to `eslint-plugin-jest` to ensure that an assertion is called after invoking `expect`. This will prevent mistakes like a stray `expect(banana);` with a missing assertion call. -* **Pretty-Format Plugins:** A number of new pretty-format plugins were added to Jest. We now pretty-print [Immutable.js](https://github.com/facebook/immutable-js/) data structures and HtmlElements in assertion failures and snapshots. -* **Custom Environment:** It is now possible to add a `@jest-environment node|jsdom` annotation to the doc-block comment of a test file to use a test environment different from the default for individual tests. +- **Better async testing:** Added new async/Promise support through resolves/rejects modifiers on expect: `expect(Promise(…)).resolves.toEqual(…)`. [See documentation](https://facebook.github.io/jest/docs/en/expect.html#resolves). +- **Expect assertions:** Along with the existing `expect.assertions(n)`, the new `expect.hasAssertions()` can be used to ensure a test has at least one assertion. +- **Lint Plugin:** A `valid-expect` rule was added to `eslint-plugin-jest` to ensure that an assertion is called after invoking `expect`. This will prevent mistakes like a stray `expect(banana);` with a missing assertion call. +- **Pretty-Format Plugins:** A number of new pretty-format plugins were added to Jest. We now pretty-print [Immutable.js](https://github.com/facebook/immutable-js/) data structures and HtmlElements in assertion failures and snapshots. +- **Custom Environment:** It is now possible to add a `@jest-environment node|jsdom` annotation to the doc-block comment of a test file to use a test environment different from the default for individual tests. Here is an example of all how all the new APIs together will make testing more delightful: @@ -68,23 +68,23 @@ This example will print a test failure similar to this: As with every major release, we are making a number of breaking changes to make larger changes in the future possible and to push the testing experience to a new level. This time, we tried our best to only break APIs that we don't expect to affect the majority of Jest's users: -* **Fork of Jasmine 2.5:** We finally decided to fork Jasmine itself and take ownership over Jest's own test runner. This will allow us to improve all aspects of the unit testing experience in the future but for now we are focused on incremental rewrites and reducing the API surface. If you see a test breaking as a result of a Jasmine API that is now missing, there should be an equivalent feature on the `jest` or `expect` objects. As such, we have removed many Jasmine features that aren't generally used in most codebases. -* **New Snapshots on CI:** Snapshots must always be committed along with the test and the modules they are testing. We changed Jest to not save new snapshots automatically in Continuous Integration (CI) environments or when the `--ci` flag is specified. To overwrite this behavior, which is generally not recommended, the `--updateSnapshot` flag can be used. -* **Babel-Polyfill:** Jest used to load `babel-polyfill` automatically when using babel-jest which resulted in memory leaks inside of Jest. In most versions of node, it is not necessary to load `babel-polyfill` so we removed this auto-inclusion and instead changed Jest to only include `regenerator-runtime` by default, which is commonly used to support async/await in older versions of Node.js. If you need `babel-polyfill`, you can manually require it in your setup files. +- **Fork of Jasmine 2.5:** We finally decided to fork Jasmine itself and take ownership over Jest's own test runner. This will allow us to improve all aspects of the unit testing experience in the future but for now we are focused on incremental rewrites and reducing the API surface. If you see a test breaking as a result of a Jasmine API that is now missing, there should be an equivalent feature on the `jest` or `expect` objects. As such, we have removed many Jasmine features that aren't generally used in most codebases. +- **New Snapshots on CI:** Snapshots must always be committed along with the test and the modules they are testing. We changed Jest to not save new snapshots automatically in Continuous Integration (CI) environments or when the `--ci` flag is specified. To overwrite this behavior, which is generally not recommended, the `--updateSnapshot` flag can be used. +- **Babel-Polyfill:** Jest used to load `babel-polyfill` automatically when using babel-jest which resulted in memory leaks inside of Jest. In most versions of node, it is not necessary to load `babel-polyfill` so we removed this auto-inclusion and instead changed Jest to only include `regenerator-runtime` by default, which is commonly used to support async/await in older versions of Node.js. If you need `babel-polyfill`, you can manually require it in your setup files. ## Other Improvements -* **Documentation:** Documentation is critical to share best practices and teach everyone how to write effective tests which will lead to better software. Over the last few weeks we have also expanded Jest's documentation to include a Snapshot Testing FAQ, a guide with information about how to use Jest with common JavaScript libraries as well as we documented the new features mentioned above. -* **Translations:** We are now asking for your help to [translate the Jest documentation](https://crowdin.com/project/jest) to make it easier for people to learn how to use Jest. -* **Custom Reporters:** Jest now supports custom test reporters through the `reporters` configuration option. You can finally customize the output of Jest as well as integrate it with other tools by generating reports in formats such as XML. [See documentation](https://facebook.github.io/jest/docs/en/configuration.html#reporters-array-modulename-modulename-options). -* **Codebase Health:** It was only possible iterate so quickly in Jest because we spent a significant amount of time on the health of the codebase. We were one of the early adopters of [prettier](https://github.com/prettier/prettier), we notably increased flow coverage, forked Jasmine to improve our test runner library and we rewrote and refactored significant portions of Jest itself to set up Jest for success in the future. -* **Bugfixes:** As always, we made plenty of bugfixes in Jest. The full changelog can be found in the [Jest repository](https://github.com/facebook/jest/blob/master/CHANGELOG.md#jest-2000). +- **Documentation:** Documentation is critical to share best practices and teach everyone how to write effective tests which will lead to better software. Over the last few weeks we have also expanded Jest's documentation to include a Snapshot Testing FAQ, a guide with information about how to use Jest with common JavaScript libraries as well as we documented the new features mentioned above. +- **Translations:** We are now asking for your help to [translate the Jest documentation](https://crowdin.com/project/jest) to make it easier for people to learn how to use Jest. +- **Custom Reporters:** Jest now supports custom test reporters through the `reporters` configuration option. You can finally customize the output of Jest as well as integrate it with other tools by generating reports in formats such as XML. [See documentation](https://facebook.github.io/jest/docs/en/configuration.html#reporters-array-modulename-modulename-options). +- **Codebase Health:** It was only possible iterate so quickly in Jest because we spent a significant amount of time on the health of the codebase. We were one of the early adopters of [prettier](https://github.com/prettier/prettier), we notably increased flow coverage, forked Jasmine to improve our test runner library and we rewrote and refactored significant portions of Jest itself to set up Jest for success in the future. +- **Bugfixes:** As always, we made plenty of bugfixes in Jest. The full changelog can be found in the [Jest repository](https://github.com/facebook/jest/blob/master/CHANGELOG.md#jest-2000). ## Talks about Jest Recently the Jest core team and other contributors started to talk more about Jest and the experience of working on Jest at conferences: -* Rogelio Guzman did a talk about [Jest Snapshots and Beyond](https://www.youtube.com/watch?time_continue=416&v=HAuXJVI_bUs) at React Conf. -* I spoke about [Building High-Quality JavaScript Tools](https://developers.facebook.com/videos/f8-2017/building-high-quality-javascript-tools/) at Facebook's F8 conference. +- Rogelio Guzman did a talk about [Jest Snapshots and Beyond](https://www.youtube.com/watch?time_continue=416&v=HAuXJVI_bUs) at React Conf. +- I spoke about [Building High-Quality JavaScript Tools](https://developers.facebook.com/videos/f8-2017/building-high-quality-javascript-tools/) at Facebook's F8 conference. _As always, this release couldn't have been possible without you, the JavaScript community. We are incredibly grateful that we get the opportunity to work on improving JavaScript testing together. If you'd like to contribute to Jest, please don't hesitate to reach out to us on [GitHub](https://github.com/facebook/jest) or on [Discord](https://discord.gg/MWRhKCj)._ diff --git a/website/blog/2017-12-18-jest-22.md b/website/blog/2017-12-18-jest-22.md index 8d53c4935012..825f748903d0 100644 --- a/website/blog/2017-12-18-jest-22.md +++ b/website/blog/2017-12-18-jest-22.md @@ -115,10 +115,10 @@ Jest 21 was released back in September, and we unfortunately never got around to The community around Jest is working hard to make the testing experience even greater. These are separate projects from the main Jest project, but we want to highlight some of our personal favorites here. -* [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot) – custom matcher to compare images with snapshots by American Express developers -* [ts-jest](https://github.com/kulshekhar/ts-jest) – all you need to successfully run Jest within TypeScript project by [@kulshekhar](https://github.com/kulshekhar/ts-jest) -* [jest-codemods](https://github.com/skovhus/jest-codemods/) – migrate your tests from other frameworks to Jest with ease -* [jest-plugins](https://github.com/negativetwelve/jest-plugins) – a new community project oriented around simplifying setting up test environment for specific tools, like React, or providing some handy utilities +- [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot) – custom matcher to compare images with snapshots by American Express developers +- [ts-jest](https://github.com/kulshekhar/ts-jest) – all you need to successfully run Jest within TypeScript project by [@kulshekhar](https://github.com/kulshekhar/ts-jest) +- [jest-codemods](https://github.com/skovhus/jest-codemods/) – migrate your tests from other frameworks to Jest with ease +- [jest-plugins](https://github.com/negativetwelve/jest-plugins) – a new community project oriented around simplifying setting up test environment for specific tools, like React, or providing some handy utilities We'd also like to announce that recently we launched a new place for high quality Jest additions – [jest-community](https://github.com/jest-community). It's a new GitHub organization already featuring our favorite projects, like [vscode-jest](https://github.com/jest-community/vscode-jest), [jest-extended](https://github.com/jest-community/jest-extended), to name a few, curated by Jest maintainers and collaborators. We've even migrated our [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) there, and already see some great contributions, which are published independently at a faster pace. diff --git a/website/blog/2018-05-29-jest-23-blazing-fast-delightful-testing.md b/website/blog/2018-05-29-jest-23-blazing-fast-delightful-testing.md index df86a9b256f3..2c523de10c49 100644 --- a/website/blog/2018-05-29-jest-23-blazing-fast-delightful-testing.md +++ b/website/blog/2018-05-29-jest-23-blazing-fast-delightful-testing.md @@ -55,13 +55,13 @@ Huge shout out to Prettier for [fixing](https://github.com/prettier/prettier/pul We only add matchers to core if we believe they will be useful to a large amount of people in the Jest community, and leave the majority of matchers to the community (see [jest-extended](https://yarnpkg.com/en/package/jest-extended)). Some matchers make the cut into core, and Jest 23 adds: -* nthCalledWith -* toReturn -* toReturnTimes -* toReturnWith -* lastReturnedWith -* nthReturnedWith -* toStrictEqual +- nthCalledWith +- toReturn +- toReturnTimes +- toReturnWith +- lastReturnedWith +- nthReturnedWith +- toStrictEqual ![New matchers in action](/jest/img/blog/23-new-matchers.png) @@ -95,34 +95,34 @@ See [jest-watch-typeahead](https://github.com/jest-community/jest-watch-typeahea As with every major release, we are making a few breaking changes to make larger changes in the future possible and to push the testing experience to a new level. Here's a list of the biggest changes you may see: -* **Require test descriptions and functions**: We're now failing tests that do not include both a function and a description. -* **Remove undefined props from React snapshots**: Smaller snapshots and proper React behavior. -* **Remove deprecations**: We removed mapCoverage since it's no longer needed. Additionally, we removed `jest.genMockFunction` and `jest.genMockFn` since these are the same as `jest.fn`. -* **Add snapshot names to failures**: We added the snapshot name (if provided) to the snapshot failure message so it's easier to find the snapshot that's failing. -* **Replace mock timestamps**: We replaced mock timestamps with invocationCallOrder since two or mocks may often have the same timestamp, making it impossible to test the call order. -* **Add results to mock snapshots**: We added mock function call results to snapshots so that both the calls and the results of the invocation are tracked. +- **Require test descriptions and functions**: We're now failing tests that do not include both a function and a description. +- **Remove undefined props from React snapshots**: Smaller snapshots and proper React behavior. +- **Remove deprecations**: We removed mapCoverage since it's no longer needed. Additionally, we removed `jest.genMockFunction` and `jest.genMockFn` since these are the same as `jest.fn`. +- **Add snapshot names to failures**: We added the snapshot name (if provided) to the snapshot failure message so it's easier to find the snapshot that's failing. +- **Replace mock timestamps**: We replaced mock timestamps with invocationCallOrder since two or mocks may often have the same timestamp, making it impossible to test the call order. +- **Add results to mock snapshots**: We added mock function call results to snapshots so that both the calls and the results of the invocation are tracked. ## Other Improvements -* **Watch mode coverage**: Coverage is now limited to only the files tested in watch mode or when using `--onlyChanged` and `--findRelatedTests`. -* **Version documentation**: We added docs for each minor release back to Jest 22, and have removed all of the “Requires Jest X.X+” from the docs. -* **Better snapshot summaries**: We overhauled the Snapshot Summary output to make obsolete snapshots more informative. -* **Better stack traces**: We added stack traces to asynchronous errors, timeout errors, expect.assertions, and thrown non-errors. We're also indicating the column in the code frame! -* **Better React 16 support**: Adds snapshot support for `React.Fragment`, `React.forwardRef`, and `React.createContext`. -* **Track mock return and throw values**: Adds `mock.results` that contains the return value or thrown value for each mock call. -* **Blazing 🔥**: We've added a blazing badge to the README to indicate that Jest is blazing good. +- **Watch mode coverage**: Coverage is now limited to only the files tested in watch mode or when using `--onlyChanged` and `--findRelatedTests`. +- **Version documentation**: We added docs for each minor release back to Jest 22, and have removed all of the “Requires Jest X.X+” from the docs. +- **Better snapshot summaries**: We overhauled the Snapshot Summary output to make obsolete snapshots more informative. +- **Better stack traces**: We added stack traces to asynchronous errors, timeout errors, expect.assertions, and thrown non-errors. We're also indicating the column in the code frame! +- **Better React 16 support**: Adds snapshot support for `React.Fragment`, `React.forwardRef`, and `React.createContext`. +- **Track mock return and throw values**: Adds `mock.results` that contains the return value or thrown value for each mock call. +- **Blazing 🔥**: We've added a blazing badge to the README to indicate that Jest is blazing good. ## Jest Summit Last week, the Jest Core Team met for the Jest Summit at Facebook London where worked on and released Jest 23, announced the Jest Open Collective, and gave a number of talks: -* **Christoph Nakazawa** – [Intro](https://www.youtube.com/watch?v=cAKYQpTC7MA) -* **Aaaron Abramov** – [Writing Meaningful Tests](https://youtu.be/cAKYQpTC7MA?t=440) -* **Rick Hanlon II** – [Blazing Fast Snapshot Testing in Jest 23](https://youtu.be/cAKYQpTC7MA?t=1881) -* **Simen Bekkhus** – [Jest's Delightful Error Messages](https://youtu.be/cAKYQpTC7MA?t=2990) -* **Matt Phillips** – [Level up your Jest experience with community packages](https://youtu.be/cAKYQpTC7MA?t=3852) -* **Michele Bertoli** – [Snapshot all the things](https://youtu.be/cAKYQpTC7MA?t=4582) -* **Jordan Eldredge** – [Webamp: Learn by imitating](https://youtu.be/cAKYQpTC7MA?t=5185) +- **Christoph Nakazawa** – [Intro](https://www.youtube.com/watch?v=cAKYQpTC7MA) +- **Aaaron Abramov** – [Writing Meaningful Tests](https://youtu.be/cAKYQpTC7MA?t=440) +- **Rick Hanlon II** – [Blazing Fast Snapshot Testing in Jest 23](https://youtu.be/cAKYQpTC7MA?t=1881) +- **Simen Bekkhus** – [Jest's Delightful Error Messages](https://youtu.be/cAKYQpTC7MA?t=2990) +- **Matt Phillips** – [Level up your Jest experience with community packages](https://youtu.be/cAKYQpTC7MA?t=3852) +- **Michele Bertoli** – [Snapshot all the things](https://youtu.be/cAKYQpTC7MA?t=4582) +- **Jordan Eldredge** – [Webamp: Learn by imitating](https://youtu.be/cAKYQpTC7MA?t=5185) Full talk is available [here](https://www.youtube.com/watch?v=cAKYQpTC7MA). diff --git a/website/versioned_docs/version-22.0/Configuration.md b/website/versioned_docs/version-22.0/Configuration.md index 1508cc908654..f31b68453883 100644 --- a/website/versioned_docs/version-22.0/Configuration.md +++ b/website/versioned_docs/version-22.0/Configuration.md @@ -184,10 +184,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -514,10 +514,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-22.0/ExpectAPI.md b/website/versioned_docs/version-22.0/ExpectAPI.md index 9e4025fbc642..b275042f19e3 100644 --- a/website/versioned_docs/version-22.0/ExpectAPI.md +++ b/website/versioned_docs/version-22.0/ExpectAPI.md @@ -158,8 +158,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -262,9 +262,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -302,8 +302,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. diff --git a/website/versioned_docs/version-22.0/JestObjectAPI.md b/website/versioned_docs/version-22.0/JestObjectAPI.md index ce941b7e1f71..8cf41bddf746 100644 --- a/website/versioned_docs/version-22.0/JestObjectAPI.md +++ b/website/versioned_docs/version-22.0/JestObjectAPI.md @@ -8,29 +8,29 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) --- diff --git a/website/versioned_docs/version-22.0/JestPlatform.md b/website/versioned_docs/version-22.0/JestPlatform.md index fa2f898a2b9d..25b3bc440975 100644 --- a/website/versioned_docs/version-22.0/JestPlatform.md +++ b/website/versioned_docs/version-22.0/JestPlatform.md @@ -10,8 +10,8 @@ You can cherry pick specific features of Jest and use them as standalone package Tool for identifying modified files in a git/hg repository. Exports two functions: -* `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. -* `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. +- `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. +- `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. ### Example @@ -96,8 +96,8 @@ console.log(getType(undefinedValue)); Tool for validating configurations submitted by users. Exports a function that takes two arguments: the user's configuration and an object containing an example configuration and other options. The return value is an object with two attributes: -* `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, -* `isValid`, a boolean indicating whether the configuration is correct or not. +- `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, +- `isValid`, a boolean indicating whether the configuration is correct or not. ### Example diff --git a/website/versioned_docs/version-22.0/MigrationGuide.md b/website/versioned_docs/version-22.0/MigrationGuide.md index 6f79177a3946..f36bd9804430 100644 --- a/website/versioned_docs/version-22.0/MigrationGuide.md +++ b/website/versioned_docs/version-22.0/MigrationGuide.md @@ -6,9 +6,9 @@ original_id: migration-guide If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/website/versioned_docs/version-22.0/MoreResources.md b/website/versioned_docs/version-22.0/MoreResources.md index d3468cfd060c..feb3abbf5056 100644 --- a/website/versioned_docs/version-22.0/MoreResources.md +++ b/website/versioned_docs/version-22.0/MoreResources.md @@ -8,11 +8,11 @@ By now you should have a good idea of how Jest can make it easy to test your app ### Browse the docs -* Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. -* Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). -* Learn how to [configure Jest](Configuration.md). -* Look at the full [API Reference](GlobalAPI.md). -* [Troubleshoot](Troubleshooting.md) problems with Jest. +- Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. +- Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). +- Learn how to [configure Jest](Configuration.md). +- Look at the full [API Reference](GlobalAPI.md). +- [Troubleshoot](Troubleshooting.md) problems with Jest. ### Learn by example diff --git a/website/versioned_docs/version-22.0/TestingFrameworks.md b/website/versioned_docs/version-22.0/TestingFrameworks.md index 01f71a702427..8646406cf37c 100644 --- a/website/versioned_docs/version-22.0/TestingFrameworks.md +++ b/website/versioned_docs/version-22.0/TestingFrameworks.md @@ -8,22 +8,22 @@ Although Jest may be considered a React-specific test runner, in fact it is a un ## Vue.js -* [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) -* [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) +- [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) +- [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) ## AngularJS -* [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) -* [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) +- [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) +- [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) ## Angular -* [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) +- [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) ## MobX -* [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) +- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) ## Redux -* [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs +- [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs diff --git a/website/versioned_docs/version-22.0/UsingMatchers.md b/website/versioned_docs/version-22.0/UsingMatchers.md index ff2dcd068b1b..99bb823740c5 100644 --- a/website/versioned_docs/version-22.0/UsingMatchers.md +++ b/website/versioned_docs/version-22.0/UsingMatchers.md @@ -46,11 +46,11 @@ test('adding positive numbers is not zero', () => { In tests you sometimes need to distinguish between `undefined`, `null`, and `false`, but you sometimes do not want to treat these differently. Jest contains helpers that let you be explicit about what you want. -* `toBeNull` matches only `null` -* `toBeUndefined` matches only `undefined` -* `toBeDefined` is the opposite of `toBeUndefined` -* `toBeTruthy` matches anything that an `if` statement treats as true -* `toBeFalsy` matches anything that an `if` statement treats as false +- `toBeNull` matches only `null` +- `toBeUndefined` matches only `undefined` +- `toBeDefined` is the opposite of `toBeUndefined` +- `toBeTruthy` matches anything that an `if` statement treats as true +- `toBeFalsy` matches anything that an `if` statement treats as false For example: diff --git a/website/versioned_docs/version-22.1/Configuration.md b/website/versioned_docs/version-22.1/Configuration.md index 3ca348e0bfec..602cc67a2ad2 100644 --- a/website/versioned_docs/version-22.1/Configuration.md +++ b/website/versioned_docs/version-22.1/Configuration.md @@ -184,10 +184,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -512,10 +512,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-22.1/ExpectAPI.md b/website/versioned_docs/version-22.1/ExpectAPI.md index bb794bc2ddf0..1c8d32ef09ec 100644 --- a/website/versioned_docs/version-22.1/ExpectAPI.md +++ b/website/versioned_docs/version-22.1/ExpectAPI.md @@ -158,8 +158,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -260,9 +260,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -300,8 +300,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. diff --git a/website/versioned_docs/version-22.1/JestObjectAPI.md b/website/versioned_docs/version-22.1/JestObjectAPI.md index 6edc27c467ab..ec5ca47adedf 100644 --- a/website/versioned_docs/version-22.1/JestObjectAPI.md +++ b/website/versioned_docs/version-22.1/JestObjectAPI.md @@ -8,29 +8,29 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) --- diff --git a/website/versioned_docs/version-22.1/MigrationGuide.md b/website/versioned_docs/version-22.1/MigrationGuide.md index 485c7b73d4a3..756232d55ac9 100644 --- a/website/versioned_docs/version-22.1/MigrationGuide.md +++ b/website/versioned_docs/version-22.1/MigrationGuide.md @@ -6,9 +6,9 @@ original_id: migration-guide If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/website/versioned_docs/version-22.2/Configuration.md b/website/versioned_docs/version-22.2/Configuration.md index 11dce126a826..311d130dc0c1 100644 --- a/website/versioned_docs/version-22.2/Configuration.md +++ b/website/versioned_docs/version-22.2/Configuration.md @@ -184,10 +184,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -340,12 +340,12 @@ Specifies notification mode. Requires `notify: true`. #### Modes -* `always`: always send a notification. -* `failure`: send a notification when tests fail. -* `success`: send a notification when tests pass. -* `change`: send a notification when the status changed. -* `success-change`: send a notification when tests pass or once when it fails. -* `failure-success`: send a notification when tests fails or once when it passes. +- `always`: always send a notification. +- `failure`: send a notification when tests fail. +- `success`: send a notification when tests pass. +- `change`: send a notification when the status changed. +- `success-change`: send a notification when tests pass or once when it fails. +- `failure-success`: send a notification when tests fails or once when it passes. ### `preset` [string] @@ -527,10 +527,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-22.2/ExpectAPI.md b/website/versioned_docs/version-22.2/ExpectAPI.md index 0ca2d35a1d39..634eb55df34a 100644 --- a/website/versioned_docs/version-22.2/ExpectAPI.md +++ b/website/versioned_docs/version-22.2/ExpectAPI.md @@ -158,8 +158,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -260,9 +260,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -300,8 +300,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. diff --git a/website/versioned_docs/version-22.2/JestObjectAPI.md b/website/versioned_docs/version-22.2/JestObjectAPI.md index 6a043bb25acd..1348db261ceb 100644 --- a/website/versioned_docs/version-22.2/JestObjectAPI.md +++ b/website/versioned_docs/version-22.2/JestObjectAPI.md @@ -8,30 +8,30 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) -* [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) --- diff --git a/website/versioned_docs/version-22.2/JestPlatform.md b/website/versioned_docs/version-22.2/JestPlatform.md index 4c6460e67654..0edcb65ce0a7 100644 --- a/website/versioned_docs/version-22.2/JestPlatform.md +++ b/website/versioned_docs/version-22.2/JestPlatform.md @@ -10,8 +10,8 @@ You can cherry pick specific features of Jest and use them as standalone package Tool for identifying modified files in a git/hg repository. Exports two functions: -* `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. -* `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. +- `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. +- `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. ### Example @@ -96,8 +96,8 @@ console.log(getType(undefinedValue)); Tool for validating configurations submitted by users. Exports a function that takes two arguments: the user's configuration and an object containing an example configuration and other options. The return value is an object with two attributes: -* `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, -* `isValid`, a boolean indicating whether the configuration is correct or not. +- `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, +- `isValid`, a boolean indicating whether the configuration is correct or not. ### Example diff --git a/website/versioned_docs/version-22.2/MigrationGuide.md b/website/versioned_docs/version-22.2/MigrationGuide.md index 50d222f20fdc..ec01abae5454 100644 --- a/website/versioned_docs/version-22.2/MigrationGuide.md +++ b/website/versioned_docs/version-22.2/MigrationGuide.md @@ -6,9 +6,9 @@ original_id: migration-guide If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/website/versioned_docs/version-22.2/MoreResources.md b/website/versioned_docs/version-22.2/MoreResources.md index dfe7903056ef..1623804cac34 100644 --- a/website/versioned_docs/version-22.2/MoreResources.md +++ b/website/versioned_docs/version-22.2/MoreResources.md @@ -8,11 +8,11 @@ By now you should have a good idea of how Jest can make it easy to test your app ### Browse the docs -* Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. -* Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). -* Learn how to [configure Jest](Configuration.md). -* Look at the full [API Reference](GlobalAPI.md). -* [Troubleshoot](Troubleshooting.md) problems with Jest. +- Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. +- Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). +- Learn how to [configure Jest](Configuration.md). +- Look at the full [API Reference](GlobalAPI.md). +- [Troubleshoot](Troubleshooting.md) problems with Jest. ### Learn by example diff --git a/website/versioned_docs/version-22.2/TestingFrameworks.md b/website/versioned_docs/version-22.2/TestingFrameworks.md index 077ba6209cf9..cc9e71b8a225 100644 --- a/website/versioned_docs/version-22.2/TestingFrameworks.md +++ b/website/versioned_docs/version-22.2/TestingFrameworks.md @@ -8,22 +8,22 @@ Although Jest may be considered a React-specific test runner, in fact it is a un ## Vue.js -* [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) -* [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) +- [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) +- [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) ## AngularJS -* [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) -* [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) +- [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) +- [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) ## Angular -* [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) +- [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) ## MobX -* [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) +- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) ## Redux -* [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs +- [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs diff --git a/website/versioned_docs/version-22.2/UsingMatchers.md b/website/versioned_docs/version-22.2/UsingMatchers.md index ecd5223d8a6f..d1f6d614c2a3 100644 --- a/website/versioned_docs/version-22.2/UsingMatchers.md +++ b/website/versioned_docs/version-22.2/UsingMatchers.md @@ -46,11 +46,11 @@ test('adding positive numbers is not zero', () => { In tests you sometimes need to distinguish between `undefined`, `null`, and `false`, but you sometimes do not want to treat these differently. Jest contains helpers that let you be explicit about what you want. -* `toBeNull` matches only `null` -* `toBeUndefined` matches only `undefined` -* `toBeDefined` is the opposite of `toBeUndefined` -* `toBeTruthy` matches anything that an `if` statement treats as true -* `toBeFalsy` matches anything that an `if` statement treats as false +- `toBeNull` matches only `null` +- `toBeUndefined` matches only `undefined` +- `toBeDefined` is the opposite of `toBeUndefined` +- `toBeTruthy` matches anything that an `if` statement treats as true +- `toBeFalsy` matches anything that an `if` statement treats as false For example: diff --git a/website/versioned_docs/version-22.3/Configuration.md b/website/versioned_docs/version-22.3/Configuration.md index 08f36dba503a..2a53ad31a92c 100644 --- a/website/versioned_docs/version-22.3/Configuration.md +++ b/website/versioned_docs/version-22.3/Configuration.md @@ -184,10 +184,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -325,12 +325,12 @@ Specifies notification mode. Requires `notify: true`. #### Modes -* `always`: always send a notification. -* `failure`: send a notification when tests fail. -* `success`: send a notification when tests pass. -* `change`: send a notification when the status changed. -* `success-change`: send a notification when tests pass or once when it fails. -* `failure-success`: send a notification when tests fails or once when it passes. +- `always`: always send a notification. +- `failure`: send a notification when tests fail. +- `success`: send a notification when tests pass. +- `change`: send a notification when the status changed. +- `success-change`: send a notification when tests pass or once when it fails. +- `failure-success`: send a notification when tests fails or once when it passes. ### `preset` [string] @@ -512,10 +512,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-22.3/ExpectAPI.md b/website/versioned_docs/version-22.3/ExpectAPI.md index dc6e2503d0ad..e162bc706430 100644 --- a/website/versioned_docs/version-22.3/ExpectAPI.md +++ b/website/versioned_docs/version-22.3/ExpectAPI.md @@ -158,8 +158,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -260,9 +260,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -300,8 +300,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. diff --git a/website/versioned_docs/version-22.3/JestObjectAPI.md b/website/versioned_docs/version-22.3/JestObjectAPI.md index 6ddb71c0aad5..0122c22883c4 100644 --- a/website/versioned_docs/version-22.3/JestObjectAPI.md +++ b/website/versioned_docs/version-22.3/JestObjectAPI.md @@ -8,30 +8,30 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) -* [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) --- diff --git a/website/versioned_docs/version-22.3/JestPlatform.md b/website/versioned_docs/version-22.3/JestPlatform.md index 4f2b2a2372f4..b78e0f34d33e 100644 --- a/website/versioned_docs/version-22.3/JestPlatform.md +++ b/website/versioned_docs/version-22.3/JestPlatform.md @@ -10,8 +10,8 @@ You can cherry pick specific features of Jest and use them as standalone package Tool for identifying modified files in a git/hg repository. Exports two functions: -* `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. -* `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. +- `getChangedFilesForRoots` returns a promise that resolves to an object with the changed files and repos. +- `findRepos` returns a promise that resolves to a set of repositories contained in the specified path. ### Example @@ -96,8 +96,8 @@ console.log(getType(undefinedValue)); Tool for validating configurations submitted by users. Exports a function that takes two arguments: the user's configuration and an object containing an example configuration and other options. The return value is an object with two attributes: -* `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, -* `isValid`, a boolean indicating whether the configuration is correct or not. +- `hasDeprecationWarnings`, a boolean indicating whether the submitted configuration has deprecation warnings, +- `isValid`, a boolean indicating whether the configuration is correct or not. ### Example diff --git a/website/versioned_docs/version-22.3/MigrationGuide.md b/website/versioned_docs/version-22.3/MigrationGuide.md index 4309eaa01131..eb77a9a48800 100644 --- a/website/versioned_docs/version-22.3/MigrationGuide.md +++ b/website/versioned_docs/version-22.3/MigrationGuide.md @@ -6,9 +6,9 @@ original_id: migration-guide If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/website/versioned_docs/version-22.3/MoreResources.md b/website/versioned_docs/version-22.3/MoreResources.md index 57f4da467f3a..9bb3481b11b2 100644 --- a/website/versioned_docs/version-22.3/MoreResources.md +++ b/website/versioned_docs/version-22.3/MoreResources.md @@ -8,11 +8,11 @@ By now you should have a good idea of how Jest can make it easy to test your app ### Browse the docs -* Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. -* Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). -* Learn how to [configure Jest](Configuration.md). -* Look at the full [API Reference](GlobalAPI.md). -* [Troubleshoot](Troubleshooting.md) problems with Jest. +- Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. +- Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). +- Learn how to [configure Jest](Configuration.md). +- Look at the full [API Reference](GlobalAPI.md). +- [Troubleshoot](Troubleshooting.md) problems with Jest. ### Learn by example diff --git a/website/versioned_docs/version-22.3/TestingFrameworks.md b/website/versioned_docs/version-22.3/TestingFrameworks.md index e4e86d84808a..bf87aff7dbb0 100644 --- a/website/versioned_docs/version-22.3/TestingFrameworks.md +++ b/website/versioned_docs/version-22.3/TestingFrameworks.md @@ -8,22 +8,22 @@ Although Jest may be considered a React-specific test runner, in fact it is a un ## Vue.js -* [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) -* [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) +- [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) +- [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) ## AngularJS -* [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) -* [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) +- [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) +- [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) ## Angular -* [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) +- [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) ## MobX -* [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) +- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) ## Redux -* [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs +- [Writing Tests](http://redux.js.org/docs/recipes/WritingTests.html) by Redux docs diff --git a/website/versioned_docs/version-22.3/UsingMatchers.md b/website/versioned_docs/version-22.3/UsingMatchers.md index 2b5356fef0b4..5e68224c7d43 100644 --- a/website/versioned_docs/version-22.3/UsingMatchers.md +++ b/website/versioned_docs/version-22.3/UsingMatchers.md @@ -46,11 +46,11 @@ test('adding positive numbers is not zero', () => { In tests you sometimes need to distinguish between `undefined`, `null`, and `false`, but you sometimes do not want to treat these differently. Jest contains helpers that let you be explicit about what you want. -* `toBeNull` matches only `null` -* `toBeUndefined` matches only `undefined` -* `toBeDefined` is the opposite of `toBeUndefined` -* `toBeTruthy` matches anything that an `if` statement treats as true -* `toBeFalsy` matches anything that an `if` statement treats as false +- `toBeNull` matches only `null` +- `toBeUndefined` matches only `undefined` +- `toBeDefined` is the opposite of `toBeUndefined` +- `toBeTruthy` matches anything that an `if` statement treats as true +- `toBeFalsy` matches anything that an `if` statement treats as false For example: diff --git a/website/versioned_docs/version-22.4/Configuration.md b/website/versioned_docs/version-22.4/Configuration.md index 7f9d7b6ed401..e58974554512 100644 --- a/website/versioned_docs/version-22.4/Configuration.md +++ b/website/versioned_docs/version-22.4/Configuration.md @@ -215,10 +215,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -356,12 +356,12 @@ Specifies notification mode. Requires `notify: true`. #### Modes -* `always`: always send a notification. -* `failure`: send a notification when tests fail. -* `success`: send a notification when tests pass. -* `change`: send a notification when the status changed. -* `success-change`: send a notification when tests pass or once when it fails. -* `failure-success`: send a notification when tests fails or once when it passes. +- `always`: always send a notification. +- `failure`: send a notification when tests fail. +- `success`: send a notification when tests pass. +- `change`: send a notification when the status changed. +- `success-change`: send a notification when tests pass or once when it fails. +- `failure-success`: send a notification when tests fails or once when it passes. ### `preset` [string] @@ -545,10 +545,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-22.4/JestObjectAPI.md b/website/versioned_docs/version-22.4/JestObjectAPI.md index dbb958527584..fc2282f27d98 100644 --- a/website/versioned_docs/version-22.4/JestObjectAPI.md +++ b/website/versioned_docs/version-22.4/JestObjectAPI.md @@ -8,30 +8,30 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) -* [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) --- diff --git a/website/versioned_docs/version-22.4/MigrationGuide.md b/website/versioned_docs/version-22.4/MigrationGuide.md index 0beefdd24269..dc46baa0b422 100644 --- a/website/versioned_docs/version-22.4/MigrationGuide.md +++ b/website/versioned_docs/version-22.4/MigrationGuide.md @@ -6,9 +6,9 @@ original_id: migration-guide If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest: -* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. -* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). -* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). +- If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to. +- If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below). +- If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below). ### jest-codemods diff --git a/website/versioned_docs/version-22.4/UsingMatchers.md b/website/versioned_docs/version-22.4/UsingMatchers.md index 63ceaf10255f..126f05d89d68 100644 --- a/website/versioned_docs/version-22.4/UsingMatchers.md +++ b/website/versioned_docs/version-22.4/UsingMatchers.md @@ -46,11 +46,11 @@ test('adding positive numbers is not zero', () => { In tests you sometimes need to distinguish between `undefined`, `null`, and `false`, but you sometimes do not want to treat these differently. Jest contains helpers that let you be explicit about what you want. -* `toBeNull` matches only `null` -* `toBeUndefined` matches only `undefined` -* `toBeDefined` is the opposite of `toBeUndefined` -* `toBeTruthy` matches anything that an `if` statement treats as true -* `toBeFalsy` matches anything that an `if` statement treats as false +- `toBeNull` matches only `null` +- `toBeUndefined` matches only `undefined` +- `toBeDefined` is the opposite of `toBeUndefined` +- `toBeTruthy` matches anything that an `if` statement treats as true +- `toBeFalsy` matches anything that an `if` statement treats as false For example: diff --git a/website/versioned_docs/version-23.0/Configuration.md b/website/versioned_docs/version-23.0/Configuration.md index 93d763dc68f7..0ebcc6db9293 100644 --- a/website/versioned_docs/version-23.0/Configuration.md +++ b/website/versioned_docs/version-23.0/Configuration.md @@ -235,10 +235,10 @@ For example, with the following configuration: Jest will fail if: -* The `./src/components` directory has less than 40% branch or statement coverage. -* One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. -* The `./src/api/very-important-module.js` file has less than 100% coverage. -* Every remaining file combined has less than 50% coverage (`global`). +- The `./src/components` directory has less than 40% branch or statement coverage. +- One of the files matching the `./src/reducers/**/*.js` glob has less than 90% statement coverage. +- The `./src/api/very-important-module.js` file has less than 100% coverage. +- Every remaining file combined has less than 50% coverage (`global`). ### `forceCoverageMatch` [array] @@ -376,12 +376,12 @@ Specifies notification mode. Requires `notify: true`. #### Modes -* `always`: always send a notification. -* `failure`: send a notification when tests fail. -* `success`: send a notification when tests pass. -* `change`: send a notification when the status changed. -* `success-change`: send a notification when tests pass or once when it fails. -* `failure-success`: send a notification when tests fails or once when it passes. +- `always`: always send a notification. +- `failure`: send a notification when tests fail. +- `success`: send a notification when tests pass. +- `change`: send a notification when the status changed. +- `success-change`: send a notification when tests pass or once when it fails. +- `failure-success`: send a notification when tests fails or once when it passes. ### `preset` [string] @@ -567,10 +567,10 @@ Default: `"jest-runner"` This option allows you to use a custom runner instead of Jest's default test runner. Examples of runners include: -* [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) -* [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) -* [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) -* [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) +- [`jest-runner-eslint`](https://github.com/jest-community/jest-runner-eslint) +- [`jest-runner-mocha`](https://github.com/rogeliog/jest-runner-mocha) +- [`jest-runner-tsc`](https://github.com/azz/jest-runner-tsc) +- [`jest-runner-prettier`](https://github.com/keplersj/jest-runner-prettier) To write a test-runner, export a class with which accepts `globalConfig` in the constructor, and has a `runTests` method with the signature: diff --git a/website/versioned_docs/version-23.0/ExpectAPI.md b/website/versioned_docs/version-23.0/ExpectAPI.md index 29a133f8046f..de8a07b7adc3 100644 --- a/website/versioned_docs/version-23.0/ExpectAPI.md +++ b/website/versioned_docs/version-23.0/ExpectAPI.md @@ -191,8 +191,8 @@ test('randocall calls its callback with a number', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match a property in `objectContaining` or `toMatchObject` ```js describe('arrayContaining', () => { @@ -359,9 +359,9 @@ test('onPress gets called with the right thing', () => { You can use it instead of a literal value: -* in `toEqual` or `toBeCalledWith` -* to match an element in `arrayContaining` -* to match a property in `objectContaining` or `toMatchObject` +- in `toEqual` or `toBeCalledWith` +- to match an element in `arrayContaining` +- to match a property in `objectContaining` or `toMatchObject` This example also shows how you can nest multiple asymmetric matchers, with `expect.stringMatching` inside the `expect.arrayContaining`. @@ -399,8 +399,8 @@ expect.addSnapshotSerializer(serializer); If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration: -* You make the dependency explicit instead of implicit. -* You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). +- You make the dependency explicit instead of implicit. +- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app). See [configuring Jest](Configuration.md#snapshotserializers-array-string) for more information. @@ -1038,8 +1038,8 @@ Use `.toStrictEqual` to test that objects have the same types as well as structu Differences from `.toEqual`: -* Keys with `undefined` properties are checked. e.g. `{a: undefined, b: 2}` does not match `{b: 2}` when using `.toStrictEqual`. -* Object types are checked to be equal. e.g. A class instance with fields `a` and `b` will not equal a literal object with fields `a` and `b`. +- Keys with `undefined` properties are checked. e.g. `{a: undefined, b: 2}` does not match `{b: 2}` when using `.toStrictEqual`. +- Object types are checked to be equal. e.g. A class instance with fields `a` and `b` will not equal a literal object with fields `a` and `b`. ```js class LaCroix { diff --git a/website/versioned_docs/version-23.0/GlobalAPI.md b/website/versioned_docs/version-23.0/GlobalAPI.md index a7b37cd45aa1..90b230680e4c 100644 --- a/website/versioned_docs/version-23.0/GlobalAPI.md +++ b/website/versioned_docs/version-23.0/GlobalAPI.md @@ -231,17 +231,17 @@ 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. -* `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. +- `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: @@ -266,11 +266,11 @@ describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( #### 2. `` describe.each`table`(name, fn) `` -* `table`: `Tagged Template Literal` - * First row of variable name column headings separated with `|` - * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -* `name`: `String` the title of the test suite, use `$variable` to inject test data into the suite title from the tagged template expressions. -* `fn`: `Function` the suite of tests to be ran, this is the function that will receive the test data object. +- `table`: `Tagged Template Literal` + - First row of variable name column headings separated with `|` + - One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- `name`: `String` the title of the test suite, use `$variable` to inject test data into the suite title from the tagged template expressions. +- `fn`: `Function` the suite of tests to be ran, this is the function that will receive the test data object. Example: @@ -475,17 +475,17 @@ 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. -* `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. +- `fn`: `Function` the test to be ran, this is the function that will receive the parameters in each row as function arguments. Example: @@ -500,11 +500,11 @@ test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( #### 2. `` test.each`table`(name, fn) `` -* `table`: `Tagged Template Literal` - * First row of variable name column headings separated with `|` - * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -* `name`: `String` the title of the test, use `$variable` to inject test data into the test title from the tagged template expressions. -* `fn`: `Function` the test to be ran, this is the function that will receive the test data object. +- `table`: `Tagged Template Literal` + - First row of variable name column headings separated with `|` + - One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. +- `name`: `String` the title of the test, use `$variable` to inject test data into the test title from the tagged template expressions. +- `fn`: `Function` the test to be ran, this is the function that will receive the test data object. Example: diff --git a/website/versioned_docs/version-23.0/JestCommunity.md b/website/versioned_docs/version-23.0/JestCommunity.md index de97d5ac493a..3f9f8fa4cb1e 100644 --- a/website/versioned_docs/version-23.0/JestCommunity.md +++ b/website/versioned_docs/version-23.0/JestCommunity.md @@ -8,10 +8,10 @@ The community around Jest is working hard to make the testing experience even gr [jest-community](https://github.com/jest-community) is a new GitHub organization for high quality Jest additions curated by Jest maintainers and collaborators. It already features some of our favorite projects, to name a few: -* [vscode-jest](https://github.com/jest-community/vscode-jest) -* [jest-extended](https://github.com/jest-community/jest-extended) -* [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) -* [awesome-jest](https://github.com/jest-community/awesome-jest) +- [vscode-jest](https://github.com/jest-community/vscode-jest) +- [jest-extended](https://github.com/jest-community/jest-extended) +- [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) +- [awesome-jest](https://github.com/jest-community/awesome-jest) Community projects under one organisation are a great way for Jest to experiment with new ideas/techniques and approaches. Encourage contributions from the community and publish contributions independently at a faster pace. diff --git a/website/versioned_docs/version-23.0/JestObjectAPI.md b/website/versioned_docs/version-23.0/JestObjectAPI.md index 0468eae9210d..ed41dd7d7106 100644 --- a/website/versioned_docs/version-23.0/JestObjectAPI.md +++ b/website/versioned_docs/version-23.0/JestObjectAPI.md @@ -8,30 +8,30 @@ The `jest` object is automatically in scope within every test file. The methods ## Methods -* [`jest.clearAllTimers()`](#jestclearalltimers) -* [`jest.disableAutomock()`](#jestdisableautomock) -* [`jest.enableAutomock()`](#jestenableautomock) -* [`jest.fn(implementation)`](#jestfnimplementation) -* [`jest.isMockFunction(fn)`](#jestismockfunctionfn) -* [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) -* [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) -* [`jest.unmock(moduleName)`](#jestunmockmodulename) -* [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) -* [`jest.dontMock(moduleName)`](#jestdontmockmodulename) -* [`jest.clearAllMocks()`](#jestclearallmocks) -* [`jest.resetAllMocks()`](#jestresetallmocks) -* [`jest.restoreAllMocks()`](#jestrestoreallmocks) -* [`jest.resetModules()`](#jestresetmodules) -* [`jest.runAllTicks()`](#jestrunallticks) -* [`jest.runAllTimers()`](#jestrunalltimers) -* [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) -* [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) -* [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) -* [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) -* [`jest.useFakeTimers()`](#jestusefaketimers) -* [`jest.useRealTimers()`](#jestuserealtimers) -* [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) -* [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) +- [`jest.clearAllTimers()`](#jestclearalltimers) +- [`jest.disableAutomock()`](#jestdisableautomock) +- [`jest.enableAutomock()`](#jestenableautomock) +- [`jest.fn(implementation)`](#jestfnimplementation) +- [`jest.isMockFunction(fn)`](#jestismockfunctionfn) +- [`jest.genMockFromModule(moduleName)`](#jestgenmockfrommodulemodulename) +- [`jest.mock(moduleName, factory, options)`](#jestmockmodulename-factory-options) +- [`jest.unmock(moduleName)`](#jestunmockmodulename) +- [`jest.doMock(moduleName, factory, options)`](#jestdomockmodulename-factory-options) +- [`jest.dontMock(moduleName)`](#jestdontmockmodulename) +- [`jest.clearAllMocks()`](#jestclearallmocks) +- [`jest.resetAllMocks()`](#jestresetallmocks) +- [`jest.restoreAllMocks()`](#jestrestoreallmocks) +- [`jest.resetModules()`](#jestresetmodules) +- [`jest.runAllTicks()`](#jestrunallticks) +- [`jest.runAllTimers()`](#jestrunalltimers) +- [`jest.advanceTimersByTime(msToRun)`](#jestadvancetimersbytimemstorun) +- [`jest.runOnlyPendingTimers()`](#jestrunonlypendingtimers) +- [`jest.setMock(moduleName, moduleExports)`](#jestsetmockmodulename-moduleexports) +- [`jest.setTimeout(timeout)`](#jestsettimeouttimeout) +- [`jest.useFakeTimers()`](#jestusefaketimers) +- [`jest.useRealTimers()`](#jestuserealtimers) +- [`jest.spyOn(object, methodName)`](#jestspyonobject-methodname) +- [`jest.spyOn(object, methodName, accessType?)`](#jestspyonobject-methodname-accesstype) --- diff --git a/website/versioned_docs/version-23.0/MoreResources.md b/website/versioned_docs/version-23.0/MoreResources.md index efe38665d31d..d4694e692576 100644 --- a/website/versioned_docs/version-23.0/MoreResources.md +++ b/website/versioned_docs/version-23.0/MoreResources.md @@ -8,11 +8,11 @@ By now you should have a good idea of how Jest can make it easy to test your app ### Browse the docs -* Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. -* Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). -* Learn how to [configure Jest](Configuration.md). -* Look at the full [API Reference](GlobalAPI.md). -* [Troubleshoot](Troubleshooting.md) problems with Jest. +- Learn about [Snapshot Testing](SnapshotTesting.md), [Mock Functions](MockFunctions.md), and more in our in-depth guides. +- Migrate your existing tests to Jest by following our [migration guide](MigrationGuide.md). +- Learn how to [configure Jest](Configuration.md). +- Look at the full [API Reference](GlobalAPI.md). +- [Troubleshoot](Troubleshooting.md) problems with Jest. ### Learn by example diff --git a/website/versioned_docs/version-23.0/TestingFrameworks.md b/website/versioned_docs/version-23.0/TestingFrameworks.md index 1e067e07a814..f67c593bc58f 100644 --- a/website/versioned_docs/version-23.0/TestingFrameworks.md +++ b/website/versioned_docs/version-23.0/TestingFrameworks.md @@ -8,22 +8,22 @@ Although Jest may be considered a React-specific test runner, in fact it is a un ## Vue.js -* [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) -* [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) +- [Testing Vue.js components with Jest](https://alexjoverm.github.io/series/Unit-Testing-Vue-js-Components-with-the-Official-Vue-Testing-Tools-and-Jest/) by Alex Jover Morales ([@alexjoverm](https://twitter.com/alexjoverm)) +- [Jest for all: Episode 1 — Vue.js](https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.d573vrce2) by Cristian Carlesso ([@kentaromiura](https://twitter.com/kentaromiura)) ## AngularJS -* [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) -* [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) +- [Testing an AngularJS app with Jest](https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251) by Matthieu Lux ([@Swiip](https://twitter.com/Swiip)) +- [Running AngularJS Tests with Jest](https://engineering.talentpair.com/running-angularjs-tests-with-jest-49d0cc9c6d26) by Ben Brandt ([@benjaminbrandt](https://twitter.com/benjaminbrandt)) ## Angular -* [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) +- [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/) by Michał Pierzchała ([@thymikee](https://twitter.com/thymikee)) ## MobX -* [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) +- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern ([@willsterndev](https://twitter.com/willsterndev)) ## Redux -* [Writing Tests](https://redux.js.org/recipes/writing-tests) by Redux docs +- [Writing Tests](https://redux.js.org/recipes/writing-tests) by Redux docs diff --git a/website/versioned_docs/version-23.0/WatchPlugins.md b/website/versioned_docs/version-23.0/WatchPlugins.md index 48ec86f72c09..568998846806 100644 --- a/website/versioned_docs/version-23.0/WatchPlugins.md +++ b/website/versioned_docs/version-23.0/WatchPlugins.md @@ -78,7 +78,7 @@ class MyWatchPlugin { Gets called whenever there is a change in the file system -* `projects: Array`: Includes all the test paths that Jest is watching. +- `projects: Array`: Includes all the test paths that Jest is watching. For example: @@ -128,8 +128,8 @@ Watch Usage To handle key press events from the key returned by `getUsageInfo`, you can implement the `run` method. This method returns a `Promise` that can be resolved when the plugin wants to return control to Jest. The `boolean` specifies if Jest should rerun the tests after it gets the control back. -* `globalConfig`: A representation of Jest's current global configuration -* `updateConfigAndRun`: Allows you to trigger a test run while the interactive plugin is running. +- `globalConfig`: A representation of Jest's current global configuration +- `updateConfigAndRun`: Allows you to trigger a test run while the interactive plugin is running. ```javascript class MyWatchPlugin { diff --git a/yarn.lock b/yarn.lock index 884c1043e058..5e8d5e10ab70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7485,9 +7485,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.12.1: - version "1.12.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325" +prettier@^1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.2.tgz#412b87bc561cb11074d2877a33a38f78c2303cda" pretty-format@^22.4.0, pretty-format@^22.4.3: version "22.4.3"