Skip to content

Commit

Permalink
Jest 13.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Jun 22, 2016
1 parent ef1bb8c commit 6f581c5
Show file tree
Hide file tree
Showing 24 changed files with 99 additions and 61 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,9 @@
## jest 14.0.0
## 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`.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -321,6 +321,7 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found
#### [Configuration Options](https://facebook.github.io/jest/docs/api.html#configuration)

- [`automock` [boolean]](https://facebook.github.io/jest/docs/api.html#automock-boolean)
- [`browser` [boolean]](https://facebook.github.io/jest/docs/api.html#browser-boolean)
- [`bail` [boolean]](https://facebook.github.io/jest/docs/api.html#bail-boolean)
- [`cacheDirectory` [string]](https://facebook.github.io/jest/docs/api.html#cachedirectory-string)
- [`coverageDirectory` [string]](https://facebook.github.io/jest/docs/api.html#coveragedirectory-string)
Expand Down Expand Up @@ -696,6 +697,11 @@ JavaScript library and would like to use Jest, you may not want to use
automocking. You can disable this option and create manual mocks or explicitly
mock modules using `jest.mock(moduleName)`.

### `browser` [boolean]
(default: false)

Respect the Browserify's [`"browser"`](https://github.com/substack/browserify-handbook#browser-field) field in `package.json` when resolving modules. Some modules export different versions based on whether they are operating in Node or a browser.

### `bail` [boolean]
(default: false)

Expand Down
29 changes: 29 additions & 0 deletions blog/2016-06-22-jest-13.md
@@ -0,0 +1,29 @@
---
title: Jest 13.0: Flow, Property Testing and REPL
author: Christoph Pojer
authorURL: http://twitter.com/cpojer
authorFBID: 100000023028168
---

Today we are happy to announce the next major release of Jest. We have made major changes to Jest which are going to benefit you and all of Facebook's JavaScript test infrastructure. Most importantly, we added static types to all of Jest's code during a recent Jest hackathon at Facebook. Fifteen people worked for a day and night to add [Flow](https://flowtype.org/) types to Jest and to add new features to Jest. The Flow types serve two purposes: First, we believe that code is written to be read. Most of the time, code is written only once but read by dozens of people over the course of years. Adding static types to the project helps document the code and helps explain some of the architecture in Jest. Second, adding static types makes maintenance easier and will allow us to more confidently refactor parts of Jest without fear of breakages.

<!--truncate-->

The Flow project has evolved a lot within Facebook and has been successfully adopted across many of our frameworks and almost all of our product code. Adoption can be parallelized incredibly well – it can be done file-by-file until enough of the codebase is well-typed. Then, Flow provides real value and helps guide through large changes. Through this, many small edge cases and bugs were found.

With the help of [lerna](https://github.com/lerna/lerna), we continued to modularize the Jest project. With just a small [update to the configuration](https://github.com/lerna/lerna#lernajson), Flow and lerna now get along well with each other. Splitting up Jest into packages helped us rethink module boundaries and enabled us to ship useful [packages](https://github.com/facebook/jest/tree/master/packages) standalone: The `jest-runtime` and `jest-repl` cli tools now allow you to run scripts in a sandboxed Jest environment, enabling you to run and debug your app from the command line. This is especially helpful for projects that use Facebook's `@providesModule` module convention. To get started, just install `jest-repl` and run it in the same folder you normally run your tests in! We also published a `jest-changed-files` package that finds changed files in version control for either git or hg, a common thing in developer tools.

## New and improved features

* A property testing feature was added directly to Jest, through [testcheck-js](https://github.com/leebyron/testcheck-js) and [jasmine-check](https://github.com/leebyron/jasmine-check/).
* 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) and added more information on [debugging Jest tests](http://facebook.github.io/jest/docs/getting-started.html#remote-debugging-with-web-inspector). Happy Jesting!
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,6 +1,6 @@
{
"lerna": "2.0.0-beta.20",
"version": "12.1.4",
"version": "13.0.0",
"linkedFiles": {
"prefix": "/**\n * @flow\n */\n"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-jest/package.json
@@ -1,6 +1,6 @@
{
"name": "babel-jest",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,6 +9,6 @@
"main": "build/index.js",
"dependencies": {
"babel-core": "^6.0.0",
"babel-preset-jest": "^12.1.0"
"babel-preset-jest": "^13.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/package.json
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-jest-hoist",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset-jest/package.json
@@ -1,13 +1,13 @@
{
"name": "babel-preset-jest",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
},
"license": "BSD-3-Clause",
"main": "index.js",
"dependencies": {
"babel-plugin-jest-hoist": "^12.1.0"
"babel-plugin-jest-hoist": "^13.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/jest-changed-files/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-changed-files",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
24 changes: 12 additions & 12 deletions packages/jest-cli/package.json
@@ -1,22 +1,22 @@
{
"name": "jest-cli",
"description": "Painless JavaScript Unit Testing.",
"version": "12.1.1",
"version": "13.0.0",
"main": "build/jest.js",
"dependencies": {
"chalk": "^1.1.1",
"graceful-fs": "^4.1.3",
"jest-changed-files": "^12.1.0",
"jest-config": "^12.1.0",
"jest-environment-jsdom": "^12.1.0",
"jest-haste-map": "^12.1.0",
"jest-jasmine1": "^12.1.0",
"jest-jasmine2": "^12.1.0",
"jest-mock": "^12.1.0",
"jest-resolve": "^12.1.1",
"jest-runtime": "^12.1.1",
"jest-util": "^12.1.0",
"jest-snapshot": "^12.1.0",
"jest-changed-files": "^13.0.0",
"jest-config": "^13.0.0",
"jest-environment-jsdom": "^13.0.0",
"jest-haste-map": "^13.0.0",
"jest-jasmine1": "^13.0.0",
"jest-jasmine2": "^13.0.0",
"jest-mock": "^13.0.0",
"jest-resolve": "^13.0.0",
"jest-runtime": "^13.0.0",
"jest-util": "^13.0.0",
"jest-snapshot": "^13.0.0",
"json-stable-stringify": "^1.0.0",
"lodash.template": "^4.2.4",
"sane": "^1.2.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/jest-config/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-config",
"version": "12.1.1",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,13 +10,13 @@
"dependencies": {
"chalk": "^1.1.1",
"istanbul": "^0.4.2",
"jest-environment-jsdom": "^12.1.0",
"jest-environment-node": "^12.1.0",
"jest-jasmine1": "^12.1.0",
"jest-jasmine2": "^12.1.0",
"jest-mock": "^12.1.0",
"jest-resolve": "^12.1.0",
"jest-util": "^12.1.0",
"jest-environment-jsdom": "^13.0.0",
"jest-environment-node": "^13.0.0",
"jest-jasmine1": "^13.0.0",
"jest-jasmine2": "^13.0.0",
"jest-mock": "^13.0.0",
"jest-resolve": "^13.0.0",
"jest-util": "^13.0.0",
"json-stable-stringify": "^1.0.0",
"node-notifier": "^4.6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/reporters/DefaultTestReporter.js
Expand Up @@ -153,7 +153,6 @@ class DefaultTestReporter {
snapshots.unmatched ||
snapshots.filesRemoved
));
this._printSnapshotSummary(snapshots);

let results = '';

Expand Down Expand Up @@ -183,6 +182,7 @@ class DefaultTestReporter {
`run time ${runTime}s)`;

this._printSummary(aggregatedResults);
this._printSnapshotSummary(snapshots);
this.log(results);

if (config.notify) {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-environment-jsdom/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-environment-jsdom",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,6 +9,6 @@
"main": "build/index.js",
"dependencies": {
"jsdom": "^9.2.1",
"jest-util": "^12.1.0"
"jest-util": "^13.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/jest-environment-node/package.json
@@ -1,14 +1,14 @@
{
"name": "jest-environment-node",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
},
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"jest-util": "^12.1.0"
"jest-util": "^13.0.0"
},
"jest": {
"rootDir": "./build",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-haste-map",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-jasmine1/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-jasmine1",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,7 +9,7 @@
"main": "build/index.js",
"dependencies": {
"graceful-fs": "^4.1.3",
"jest-util": "^12.1.0"
"jest-util": "^13.0.0"
},
"jest": {
"rootDir": "./build",
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-jasmine2/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-jasmine2",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,8 +10,8 @@
"dependencies": {
"graceful-fs": "^4.1.3",
"jasmine-check": "^0.1.4",
"jest-snapshot": "^12.1.0",
"jest-util": "^12.1.0"
"jest-snapshot": "^13.0.0",
"jest-util": "^13.0.0"
},
"jest": {
"rootDir": "./build",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-mock/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-mock",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-repl/package.json
@@ -1,15 +1,15 @@
{
"name": "jest-repl",
"version": "12.1.1",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
},
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"jest-runtime": "^12.1.0",
"jest-util": "^12.1.0",
"jest-runtime": "^13.0.0",
"jest-util": "^13.0.0",
"repl": "^0.1.3",
"yargs": "^4.7.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-resolve/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-resolve",
"version": "12.1.1",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,7 +9,7 @@
"main": "build/index.js",
"dependencies": {
"browser-resolve": "^1.11.2",
"jest-haste-map": "^12.1.0",
"jest-haste-map": "^13.0.0",
"resolve": "^1.1.6"
},
"jest": {
Expand Down
18 changes: 9 additions & 9 deletions packages/jest-runtime/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-runtime",
"version": "12.1.1",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,21 +9,21 @@
"main": "build/index.js",
"dependencies": {
"graceful-fs": "^4.1.3",
"jest-config": "^12.1.0",
"jest-environment-jsdom": "^12.1.0",
"jest-haste-map": "^12.1.0",
"jest-mock": "^12.1.0",
"jest-resolve": "^12.1.0",
"jest-snapshot": "^12.1.0",
"jest-util": "^12.1.0",
"jest-config": "^13.0.0",
"jest-environment-jsdom": "^13.0.0",
"jest-haste-map": "^13.0.0",
"jest-mock": "^13.0.0",
"jest-resolve": "^13.0.0",
"jest-snapshot": "^13.0.0",
"jest-util": "^13.0.0",
"json-stable-stringify": "^1.0.0",
"yargs": "^4.7.1"
},
"bin": {
"jest-runtime": "./bin/jest-runtime.js"
},
"devDependencies": {
"jest-config": "^12.1.0"
"jest-config": "^13.0.0"
},
"jest": {
"automock": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-snapshot/package.json
@@ -1,14 +1,14 @@
{
"name": "jest-snapshot",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
},
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"jest-util": "^12.1.0",
"jest-util": "^13.0.0",
"pretty-format": "^3.3.0"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-util/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-util",
"version": "12.1.0",
"version": "13.0.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -12,7 +12,7 @@
"diff": "^2.1.1",
"graceful-fs": "^4.1.3",
"mkdirp": "^0.5.1",
"jest-mock": "^12.1.0"
"jest-mock": "^13.0.0"
},
"devDependencies": {
"jsdom": "^9.2.1"
Expand Down
1 change: 0 additions & 1 deletion packages/jest-util/src/index.js
Expand Up @@ -55,7 +55,6 @@ exports.FakeTimers = require('./FakeTimers');
exports.JasmineFormatter = require('./JasmineFormatter');
exports.NullConsole = require('./NullConsole');


exports.createDirectory = createDirectory;
exports.escapeStrForRegex = escapeStrForRegex;
exports.formatFailureMessage = require('./formatFailureMessage');
Expand Down

1 comment on commit 6f581c5

@alvinsj
Copy link

@alvinsj alvinsj commented on 6f581c5 Jun 27, 2016

Choose a reason for hiding this comment

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

πŸ‘ πŸ‘ πŸ‘ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸ’₯ 🎊

Please sign in to comment.