Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jest 23 Blog Post #6332

Merged
merged 5 commits into from
May 30, 2018
Merged

Add Jest 23 Blog Post #6332

merged 5 commits into from
May 30, 2018

Conversation

rickhanlonii
Copy link
Member

@rickhanlonii rickhanlonii commented May 28, 2018

Screen

blog screenshot

@codecov-io
Copy link

codecov-io commented May 28, 2018

Codecov Report

Merging #6332 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6332   +/-   ##
=======================================
  Coverage   63.89%   63.89%           
=======================================
  Files         228      228           
  Lines        8705     8705           
  Branches        3        4    +1     
=======================================
  Hits         5562     5562           
  Misses       3142     3142           
  Partials        1        1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5ed1a5...5325857. Read the comment docs.

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Nice post! Left some minor nits to fix


* **Require test descriptions**: We're now failing tests that do not include a description.
* **Remove undefined props from React snapshots:** Smaller snapshots and proper React behavior.
* **Remove deprecations**: We've removed mapCoverage since it's no longer needed. Additionally, we removed `jest.genMockFunction` and `jest.genMockFn` since these are the same `jest.fn`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same as jest.fn


Today we are excited to announce Jest 23, our largest major release to date! Together with over 100 contributors, we've shipped a ton of features and bug fixes. Thank you to everyone in the community for helping make JavaScript Testing Delightful.

We would also like to welcome Webpack to the Jest community! After converting from Mocha to Jest 23 Beta, their total test suite time was reduced 6x from over 13 minutes to 2 minutes 20 seconds. #blazingmeansgood
Copy link
Collaborator

Choose a reason for hiding this comment

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

A link to the tweet for the blazing tag maybe :D


## Jest Each

[@mattphillipsio](https://twitter.com/mattphillipsio) has donated the `jest-each` package to Jest Core (thanks Matt!). jest-each is a library inspired by [mocha-each](https://yarnpkg.com/en/package/mocha-each) and [Spock Data Tables](http://spockframework.org/spock/docs/1.1/data_driven_testing.html#data-tables) which allows you to define a table of test cases, and then run a test for each row with the specified column values. We support both array types and template literals for all flavors of `describe` and `test`. Docs are available [here](https://facebook.github.io/jest/docs/en/api.html#testeachtable-name-fn), and for those not on Jest 23 yet, we're still publishing [jest-each](https://yarnpkg.com/en/package/jest-each) separately!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add backticks to library name

## Debug Hanging Tests

A common issue we see on the issue tracker relates to “Jest” hanging after a test run. This is usually due to app code leaving handles open, preventing Jest from exiting. In the past, users have resorted to `—forceExit` to fix (not recommended).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Double dash in flag

* **Require test descriptions**: We're now failing tests that do not include a description.
* **Remove undefined props from React snapshots:** Smaller snapshots and proper React behavior.
* **Remove deprecations**: We've removed mapCoverage since it's no longer needed. Additionally, we removed `jest.genMockFunction` and `jest.genMockFn` since these are the same `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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There need to be a space between ** and We, otherwise it breaks styling


* **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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing with **


## Other Improvements

* **Watch mode coverage**: Coverage is now limited to only the files tested in watch mode or when using `—onlyChanged` and `—findRelatedTests`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure all the flags are double dashed


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**: We're now failing tests that do not include a description.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wasn't it test callbacks? Or is it something else than #5558

Copy link
Member

Choose a reason for hiding this comment

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

we need 2 args always, so both 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's both @SimenB can you confirm?

Copy link
Member

Choose a reason for hiding this comment

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

yes, both

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**: We're now failing tests that do not include a description.
* **Remove undefined props from React snapshots:** Smaller snapshots and proper React behavior.
Copy link
Member

Choose a reason for hiding this comment

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

inconsistent ** before or after the :


## 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:
Copy link
Member

Choose a reason for hiding this comment

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

mention they'll be posted soon:tm:?

Copy link
Member

Choose a reason for hiding this comment

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

the videos, that is

Copy link
Member Author

Choose a reason for hiding this comment

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

Hoping to update this with the links before go-live


We have completely rewritten the watch mode system to allow adding custom plugins to watch mode. Watch Mode Plugins now make it possible to hook into Jest events and provide custom menu options in the Watch Mode Menu. All of the default Watch Mode prompts are implemented as plugins in this system, and the docs to create your own are available [here](https://facebook.github.io/jest/docs/en/watch-plugins.html).

With this change, we're also now able to bring back typeahead support as a Watch Mode Plugin via [](https://github.com/rogeliog/jest-plugin-filename)[jest-plugin-filename](https://github.com/jest-community/jest-plugin-filename)!
Copy link
Member

Choose a reason for hiding this comment

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

link here looks weird


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
Copy link
Member

@SimenB SimenB May 29, 2018

Choose a reason for hiding this comment

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

something about the fact that mocks now track returned and thrown values would be nice


## Snapshot Property Matchers

Often times, objects you're snapshotting contain generated values like Dates and IDs. Jest now allows you to pass properties to the snapshot matcher which specify the structure of the data instead of the specific values. These property matchers are then verified before serializing the matcher type (instead of the value), giving you consistent snapshot results across test runs.
Copy link
Member

Choose a reason for hiding this comment

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

not a native speaker, but
image

Copy link
Member Author

Choose a reason for hiding this comment

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

:D

@@ -0,0 +1,124 @@
---
title: Jest 23: 🚀 Blazing Fast Delightful Testing
Copy link
Member

Choose a reason for hiding this comment

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

replace 🚀 with 🔥?


See [jest-plugin-filename](https://github.com/jest-community/jest-plugin-filename) for documentation and install instructions. Huge thank you to [@rogeliog](https://twitter.com/rogeliog) for the new watch mode plugin system and the jest-plugin-filename plugin!

## Breaking Changes
Copy link
Member

Choose a reason for hiding this comment

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

* **Aaaron Abramov** – Writing Meaningful Tests
* **Rick Hanlon II** – Blazing Fast Snapshot Testing in Jest 23
* **Simen Bekkhus** – Jest's Delightful Error Messages
* **Matt Philips** – Level up your Jest experience with community packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Two ls in Phillips 😛

@rickhanlonii
Copy link
Member Author

Thanks all, fixes pushed!

* **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.
Copy link
Member

Choose a reason for hiding this comment

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

haha

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

Would be awesome to have links to the summit video(s) before publish, but the post LGTM

@cpojer cpojer merged commit d633199 into jestjs:master May 30, 2018
@rickhanlonii rickhanlonii deleted the rh-23-blog-post branch May 30, 2018 14:26
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants