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

Switch to jestjs.io #6549

Merged
merged 4 commits into from
Jun 26, 2018
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## master

### Chore & Maintenance

- `[website]` Switch domain to https://jestjs.io ([#6549](https://github.com/facebook/jest/pull/6549))

## 23.2.0

### Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ Learn more about using [Jest on the official site!](http://facebook.github.io/je

## Badge

Show the world you're using _Jest_ → [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) [![jest](https://facebook.github.io/jest/img/jest-badge.svg)](https://github.com/facebook/jest)
Show the world you're using _Jest_ → [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) [![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
Copy link
Member Author

Choose a reason for hiding this comment

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

The old badges still work, but I updated the badge to the new host


```md
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) [![jest](https://facebook.github.io/jest/img/jest-badge.svg)](https://github.com/facebook/jest)
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) [![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
```

## Contributing
Expand Down
8 changes: 4 additions & 4 deletions docs/SnapshotTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ it('renders correctly', () => {

In that case, Jest will print this output:

![](/jest/img/content/failedSnapshotTest.png)
![](/img/content/failedSnapshotTest.png)

Since we just updated our component to point to a different address, it's reasonable to expect changes in the snapshot for this component. Our snapshot test case is failing because the snapshot for our updated component no longer matches the snapshot artifact for this test case.

Expand All @@ -81,17 +81,17 @@ You can try out this functionality by cloning the [snapshot example](https://git

Failed snapshots can also be updated interactively in watch mode:

![](/jest/img/content/interactiveSnapshot.png)
![](/img/content/interactiveSnapshot.png)

Once you enter Interactive Snapshot Mode, Jest will step you through the failed snapshots one test at a time and give you the opportunity to review the failed output.

From here you can choose to update that snapshot or skip to the next:

![](/jest/img/content/interactiveSnapshotUpdate.gif)
![](/img/content/interactiveSnapshotUpdate.gif)

Once you're finished, Jest will give you a summary before returning back to watch mode:

![](/jest/img/content/interactiveSnapshotDone.png)
![](/img/content/interactiveSnapshotDone.png)

### Property Matchers

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"homepage": "http://facebook.github.io/jest/",
"homepage": "http://jestjs.io/",
"license": "MIT",
"keywords": [
"ava",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ class Runtime {
if (mockMetadata == null) {
throw new Error(
`Failed to get mock metadata: ${modulePath}\n\n` +
`See: http://facebook.github.io/jest/docs/manual-mocks.html#content`,
`See: http://jestjs.io/docs/manual-mocks.html#content`,
);
}
this._mockMetaDataCache[modulePath] = mockMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
exports[`FakeTimers runAllTimers warns when trying to advance timers while real timers are used 1`] = `
"A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`\\"timers\\": \\"fake\\"\` in the configuration file. This warning is likely a result of a default configuration change in Jest 15.

Release Blog Post: https://facebook.github.io/jest/blog/2016/09/01/jest-15.html"
Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15.html"
`;
2 changes: 1 addition & 1 deletion packages/jest-util/src/fake_timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export default class FakeTimers<TimerRef> {
`\`"timers": "fake"\` in ` +
`the configuration file. This warning is likely a result of a ` +
`default configuration change in Jest 15.\n\n` +
`Release Blog Post: https://facebook.github.io/jest/blog/2016/09/01/jest-15.html\n` +
`Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15.html\n` +
`Stack Trace:\n` +
formatStackTrace(new Error().stack, this._config, {
noStackTrace: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "git",
"url": "https://github.com/facebook/jest"
},
"homepage": "http://facebook.github.io/jest/",
"homepage": "http://jestjs.io/",
"license": "MIT",
"keywords": [
"ava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Most of the time our static analysis determines that more than one test needs to

Recently we noticed Jest often seemed stuck _“Waiting for 3 tests”_ for up to a minute toward the end of a run. It turned out we had a few really slow tests in our codebase that were dominating the test runtime. While we were able to speed these individual tests up significantly, we also made a change in how Jest schedules test runs. Previously we used to schedule test runs based on file system traversal, which was actually quite random. Here is an example of 11 tests in gray blocks over two workers. The size of the block is the runtime of the test:

![perf-basic-scheduling](/jest/img/blog/Scheduling1.png)
![perf-basic-scheduling](/img/blog/Scheduling1.png)

We were randomly running a mix of fast and slow tests, and one of our slowest tests ended up running as almost all the other tests were completed, during which the second worker sat idle.

We made a change to schedule tests based on their file size which is usually a good proxy for how long a test is going to take. A test with a few thousand lines of code likely takes longer than a test with 15 lines of code. While this sped up the entire test run by about 10%, we ended up finding a better heuristic: now Jest stores the runtime of each test in a cache and on subsequent runs, it schedules the slowest tests to run first. Overall this helped improve the runtime of all tests by about 20%.

Here is an example of the same test run from before with better scheduling:

![perf-improved-scheduling](/jest/img/blog/Scheduling2.png)
![perf-improved-scheduling](/img/blog/Scheduling2.png)

Because we are running slow tests first, Jest can sometimes seem to take a long time to start up – we only print results after the first test has completed. For the future we are planning to run previously failed tests first, because getting that info to developers as quickly as possible matters the most.

Expand Down
2 changes: 1 addition & 1 deletion website/blog/2016-07-27-jest-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The snapshot artifact should be committed alongside code changes. We use [pretty

If we change the address the Link component in our example is pointing to, Jest will print this output:

![snapshot-testing](/jest/img/blog/snapshot.png)
![snapshot-testing](/img/blog/snapshot.png)

Now you know that you either need to accept the changes with `jest -u`, or fix the component if the changes were unintentional. To try out this functionality, please clone the [snapshot example](https://github.com/facebook/jest/tree/master/examples/snapshot), modify the Link component and run Jest. We updated the [React Tutorial](/jest/docs/tutorial-react.html) with a new guide for 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 @@ -15,13 +15,13 @@ The most important change to talk about is a set of [new defaults](https://githu

As part of our effort to remove Jasmine incrementally within Jest, replacing all Jasmine matchers was almost completed. A lot of time was spent tweaking every error message for every matcher to give the best signal to users when a test is failing – the time when Jest should provide the most value to you. In addition to printing the expected and received values, a diff is printed for the `toBe` and `toEqual` matchers to help spot mistakes. More colors were added and relevant files from stack traces are highlighted more prominently.

Here is a comparison of the before and after on a light terminal: ![failure1](/jest/img/blog/15-failure1.png) It also works well with darker colors: ![failure2](/jest/img/blog/15-failure2.png)
Here is a comparison of the before and after on a light terminal: ![failure1](/img/blog/15-failure1.png) It also works well with darker colors: ![failure2](/img/blog/15-failure2.png)

## New watch command

We completely rewrote `jest --watch` to be more interactive. It can now switch between running all tests or only test files related to changed files by pressing `a` or `o`. By pressing `p` a prompt appears that allows to specify a test pattern to focus on a specific set of files. Snapshot tests can be updated by pressing `u`.

![watch](/jest/img/blog/15-watch.gif)
![watch](/img/blog/15-watch.gif)

## jest-react-native improvements

Expand All @@ -40,7 +40,7 @@ There have also been a number of improvements around mocking images, the fetch m

Jest parallelizes test runs across workers to maximize performance. Previously Jest used to forward console messages from workers to the parent and printed them immediately. When running multiple tests in parallel, it was often hard to find out which test and which module was calling a log function. In Jest 15, all console messages are buffered and printed together with individual test results. In addition the file and line number of the log call is printed so the code can easily be inspected.

Compare the output of the previous version of Jest and Jest 15: ![console](/jest/img/blog/15-console.png)
Compare the output of the previous version of Jest and Jest 15: ![console](/img/blog/15-console.png)

## Disabled Automocking

Expand Down
6 changes: 3 additions & 3 deletions website/blog/2016-10-03-jest-16.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It's been one month since the last major release and we've made significant impr

## Upgraded CLI

![reporter](/jest/img/blog/16-reporter.gif)
![reporter](/img/blog/16-reporter.gif)

Jest 16 features a new reporter interface that shows running tests as well as a live summary and a progress bar based on the estimated test runtime from previous test runs. We also improved the CLI output to work better with different color schemes. If there were test failures in a previous run, Jest will now always run those tests first to give useful signal to users as quickly as possible.

Expand All @@ -28,7 +28,7 @@ We also added a lot of new features which you may find useful:
- We improved module resolution when `moduleNameMapper` is used.
- Finally, a `--findRelatedTests <fileA> <fileB>` 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)
This is what Jest looks like when a test run is interrupted in watch mode: ![watch](/img/blog/16-watch.gif)

## Snapshot Updates

Expand All @@ -38,7 +38,7 @@ Jest's snapshot implementation was completely rewritten. The new version of the
- 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)
When upgrading to Jest 16, the diff might look similar to this one: ![snapshots](/img/blog/16-snapshots.png)

## Test Library Updates

Expand Down
10 changes: 5 additions & 5 deletions website/blog/2017-01-30-a-great-developer-experience.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ We have created a [showcase of users](/jest/users.html) to highlight some of the

<div class="productShowcaseSection">
<div class="logos">
<img src="/jest/img/logos/twitter.png" title="Twitter"/>
<img src="/jest/img/logos/pinterest.png" title="Pinterest"/>
<img src="/jest/img/logos/paypal.png" title="PayPal"/>
<img src="/jest/img/logos/ibm.png" title="IBM"/>
<img src="/jest/img/logos/spotify.png" title="Spotify"/>
<img src="/img/logos/twitter.png" title="Twitter"/>
<img src="/img/logos/pinterest.png" title="Pinterest"/>
<img src="/img/logos/paypal.png" title="PayPal"/>
<img src="/img/logos/ibm.png" title="IBM"/>
<img src="/img/logos/spotify.png" title="Spotify"/>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ exports[`snap 1`] = `

We decided it's a good time to introduce versioned snapshots to ensure all developers are using a compatible version of Jest. Here's how we warn you about the need to update your snapshot:

![snapshot-version](/jest/img/blog/19-snapshot-version.png)
![snapshot-version](/img/blog/19-snapshot-version.png)

Please make sure you revert any local changes before updating to make the transition smooth and to ensure you aren't including any unwanted changes from failing tests in your new snapshots.

## Improved printing of skipped tests

Skipped tests are now printed as a single line instead of showing every individual one when testing in verbose mode or a single suite. Hopefully it will let you focus on currently important tests. It also occupies far less space!

![skipped-tests](/jest/img/blog/19-skipped-tests.png)
![skipped-tests](/img/blog/19-skipped-tests.png)

## New CLI arguments

Expand All @@ -73,7 +73,7 @@ Jest 19 ships with two new coverage-related arguments which you can run from CLI

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`:

![cli-error](/jest/img/blog/19-cli-error.png)
![cli-error](/img/blog/19-cli-error.png)

## `expect` Improvements

Expand All @@ -99,15 +99,15 @@ While we refactored the validation and normalization code for Jest's configurati

`jest-validate` is a generic configuration validation tool that helps you with warnings, errors and deprecation messages in your JavaScript tool. It's also capable of showing users friendly examples of correct configuration and it comes with a simple but powerful API. We hope it'll make a good addition to your projects!

![validate](/jest/img/blog/19-validate.png)
![validate](/img/blog/19-validate.png)

We're happy to announce that `jest-validate` is validating config options of [prettier](https://github.com/jlongster/prettier) since [v0.12](https://github.com/jlongster/prettier/blob/master/CHANGELOG.md#0120). Feel free to add it to your project, try it, send us feedback and improve it by making pull requests on GitHub.

## Improved asymmetric matchers

We moved the asymmetric matchers implementation from Jasmine into Jest, which enabled us to further improve the user experience around them. As a result, asymmetric matchers are now pretty-printed nicely, we added the new [`expect.stringContaining()`](http://facebook.github.io/jest/docs/expect.html#expectstringcontainingstring) matcher and we also paired them with [`expect.toMatchObject()`](http://facebook.github.io/jest/docs/expect.html#tomatchobjectobject) so you can use the best of both:

![asymmetric-matchers](/jest/img/blog/19-asymmetric-matchers.png)
![asymmetric-matchers](/img/blog/19-asymmetric-matchers.png)

## Better manual mocks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A few months ago we announced [Jest 19](http://facebook.github.io/jest/blog/2017

Until now, Jest could only operate in one project at a time. This is often cumbersome if you are working on many smaller projects that each have their own setup and configuration. With Jest 20, we rewrote the test runner completely to run many projects at the same time within a single instance of Jest, for example if you are working on a React frontend and a node.js backend. Here is a video of Jest running tests for [React](https://github.com/facebook/react), [Relay](https://github.com/facebook/relay), [Yarn](https://github.com/yarnpkg/yarn) and Jest all at the same time:

![multi-runner](/jest/img/blog/20-multi-runner.gif)
![multi-runner](/img/blog/20-multi-runner.gif)

<!--truncate-->

Expand Down Expand Up @@ -62,7 +62,7 @@ test('compares apples and bananas', async () => {

This example will print a test failure similar to this:

![testing-apis](/jest/img/blog/20-testing-apis.png)
![testing-apis](/img/blog/20-testing-apis.png)

## Breaking Changes

Expand Down
6 changes: 3 additions & 3 deletions website/blog/2017-12-18-jest-22.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ test('some test', () => {

In Jest 21, we would display the following error:

![failure in Jest 21](/jest/img/blog/22-failure-21.png)
![failure in Jest 21](/img/blog/22-failure-21.png)

In Jest 22, we have added a codeframe, giving more context to the failing assertions. We have also cleaned up the stack trace to remove more clutter than ever.

![failure in Jest 22](/jest/img/blog/22-failure-22.png)
![failure in Jest 22](/img/blog/22-failure-22.png)

## Easier testing of errors thrown in async code

Expand Down Expand Up @@ -122,7 +122,7 @@ The community around Jest is working hard to make the testing experience even gr

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.

![Jest Community](/jest/img/blog/22-community.png)
![Jest Community](/img/blog/22-community.png)

Community projects under one organisation are also a great way for us to experiment on things like automated releases, which we'd like to explore for Jest as well. They also enable us to share some common things between them, like the shape of the README for example (thanks to the webpack Community for the idea), making it easier to learn and use for all of us.

Expand Down
Loading