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

docs: clean up formatting of blog posts #13862

Merged
merged 4 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ module.exports = {
'jest/prefer-to-have-length': 'off',
},
},
// snapshot in an example needs to keep escapes
{
files: [
'**/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md/**',
],
rules: {
'no-useless-escape': 'off',
},
},

// snapshots in examples plus inline snapshots need to keep backtick
{
Expand Down
2 changes: 1 addition & 1 deletion website/blog/2016-04-12-jest-11.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Today we're announcing a switch to major revisions for Jest with Jest 11.0 being

If you are using Jest 0.9 or Jest 0.10 the upgrade should be seamless. All changes from the last few months were rolled into Jest 11.0.

### New in Jest 11.0.
### New in Jest 11.0

#### Babel Integration and Simplified Setup

Expand Down
6 changes: 5 additions & 1 deletion website/blog/2016-07-27-jest-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ You can start using Jest with react-native by running `yarn add --dev jest-react
- [Example project](https://github.com/facebook/jest/tree/main/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!_
:::info

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!

:::

## Why snapshot testing?

Expand Down
6 changes: 3 additions & 3 deletions website/blog/2016-09-01-jest-15.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We completely rewrote `jest --watch` to be more interactive. It can now switch b

Mocks for `ListView`, `TextInput`, `ActivityIndicator`, `ScrollView` and more were added. The existing mocks were updated to use the real implementations and existing snapshots likely have to be updated when upgrading to Jest 15. A `mockComponent` function was added to `jest-react-native` that can be used to mock native components:

```
```js
jest.mock('MyNativeComponent', () => {
const jestReactNative = require('jest-react-native');
return jestReactNative.mockComponent('MyNativeComponent');
Expand Down Expand Up @@ -60,12 +60,12 @@ This has lead to numerous incompatibilities. We also noticed that at Facebook we

Here is an example:

```
```js
const React1 = require('react');
jest.resetModules();
const React2 = require('react');

React1 !== React2 // These two are separate copies of React.
React1 !== React2; // These two are separate copies of React.
```

The call to `resetModules` wipes away the require cache. A second call to require the same module will result in a new instantiation of the same module and all of its dependencies. This feature is especially useful when dealing with modules that have side effects, like [jest-haste-map](https://github.com/facebook/jest/blob/3bbf32a239fc4aad8cc6928a787f235bd86fecac/packages/jest-haste-map/src/__tests__/index-test.js#L64).
Expand Down
22 changes: 11 additions & 11 deletions website/blog/2016-12-15-2016-in-jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ Jest was initially created more than five years ago and as such an old framework
- **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 `<rootDir>` is no longer needed for these options.
- **Added: **`pretty-format` and `jest-editor-support` were merged into Jest.
- **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:** `--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:** `.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.
- **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.
Expand All @@ -84,16 +84,16 @@ Jest was initially created more than five years ago and as such an old framework
- **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:** `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:** `.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`.
- **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

Expand All @@ -102,7 +102,7 @@ Six months ago [we shared our plans for Jest](/blog/2016/07/27/jest-14#what-s-ne
- **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.
- **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.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We made a couple of changes to the snapshot format. We don't make changes like t

Before:

```
```js
exports[`test snap 1`] = `
<header>
<h1>
Expand All @@ -37,7 +37,7 @@ exports[`test snap 1`] = `

After (no “test” prefix, better JSX rendering, version header):

```
```js
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snap 1`] = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Jest is now collapsing the usage guide after the first test run to save vertical

Further, we completely overhauled how the configuration system works inside of Jest. You can now pass any configuration option through the CLI to overwrite the ones specified in your configuration file. Along with that, we changed Jest to look for a `jest.config.js` file by default which means you are now able to define a Jest configuration using JavaScript as well as being able to configure it through `package.json` like before. Through the addition of all these new features, you are now able to combine Jest in more powerful ways than ever before. For example, if you would like to find out which tests Jest would run given a set of changed files from a commit across multiple projects in a monorepo, you can combine cli arguments like this now:

```
```bash
$ jest --projects projectA projectB --listTests --findRelatedTests projectA/banana.js projectB/kiwi.js
[
"projectA/banana.test.js",
Expand Down
16 changes: 8 additions & 8 deletions website/blog/2018-06-27-supporting-jest-open-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ In this post we'll outline what the Jest Open Collective is, the structure, and

<!--truncate-->

# The Jest Open Collective
## The Jest Open Collective

![Banner image for Jest Open Collective](/img/blog/collective.png)

Open Collective is a platform to manage groups of people transparently. Jest joins projects like [webpack](https://opencollective.com/webpack), [Babel](https://opencollective.com/babel), [Mocha](https://opencollective.com/mochajs), [Preact](https://opencollective.com/preact), [Vue](https://opencollective.com/vuejs), and many more in supporting the open source community through the Open Collective platform.

## What is the Jest Open Collective
### What is the Jest Open Collective

The Jest Open Collective is a group of open source contributors who operate in full transparency to:

- Receive funds from backers and sponsors
- Approve expenses submitted by the community
- Give everyone visibility on the budget

## What is the structure of the collective
### What is the structure of the collective

The Jest Open Collective is currently managed by three non-Facebook core contributors from the open source community:

Expand All @@ -43,15 +43,15 @@ Michal has been an active Jest contributor since September 2016, Simen joined th

There are two levels of support for the collective: Backer and Sponsor.

### Backers
#### Backers

Backers of the collective are individuals contributing at least \$2/month. We'll include a list of backers on the Jest homepage, README on github/yarn/npm, and Contributors page.

### Sponsors
#### Sponsors

Sponsors of the collective are individuals and organizations contributing at least \$100/month. We'll place sponsor logos with a link to their site on the Jest homepage, README on github/yarn/npm, and Contributors page.
Sponsors of the collective are individuals and organizations contributing at least $100/month. We'll place sponsor logos with a link to their site on the Jest homepage, README on github/yarn/npm, and Contributors page.

## What is the goal of the collective
### What is the goal of the collective

The goal of the collective is to support the work of open source contributors to Jest in order to make testing delightful.

Expand All @@ -64,7 +64,7 @@ To achieve that goal, we will use the funds to:

This is just the beginning and we're committed to getting this right. If you have ideas on how else we can support the community, or feedback on the structure of the collective, please reach out to us on [twitter](https://twitter.com/fbjest)!

# Thank You
## Thank You

Finally, thank you to everyone who contributes to the Jest community and open source in general. We are incredibly grateful that we get the opportunity to work on improving JavaScript testing together.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ If you want to run typechecks while you test, you should use [`ts-jest`](https:/

See [the docs](/docs/getting-started#using-typescript) for more details.

_Note that if you for whatever reason cannot upgrade to Babel 7, you can still use Jest 24 with `babel@6` as long as you keep `babel-jest` at version 23._
:::tip

If you for whatever reason cannot upgrade to Babel 7, you can still use Jest 24 with `babel@6` as long as you keep `babel-jest` at version 23.

:::

## `test.todo`

Expand Down
2 changes: 1 addition & 1 deletion website/blog/2022-08-25-jest-29.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Jest 29 is here, just a few short months after Jest 28. As mentioned in the [Jes

<!--truncate-->

The only breaking changes that should be noticable are:
The only breaking changes that should be noticeable are:

- Node versions 12 and 17 are dropped, both of which are EOL
- The `snapshotFormat` property is changed to:
Expand Down