Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into remove-retainlines
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/jest-jasmine2/package.json
#	packages/jest-util/package.json
  • Loading branch information
rickhanlonii committed Feb 20, 2018
2 parents 0a29175 + da90886 commit e7ccbc6
Show file tree
Hide file tree
Showing 40 changed files with 246 additions and 114 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
## master

### Features

* `[jest-runtime]` Provide `require.main` property set to module with test suite
([#5618](https://github.com/facebook/jest/pull/5618))
* `[docs]` Add note about Node version support ([#5622](https://github.com/facebook/jest/pull/5622))

## 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
Expand All @@ -28,6 +40,8 @@
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))

Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Or via [`yarn`](https://yarnpkg.com/en/package/jest):
yarn add --dev jest
```

The minimum supported Node version is `v6.0.0` by default. If you need to
support Node 4, refer to the
[Compatibility issues](https://facebook.github.io/jest/docs/en/troubleshooting.html#compatibility-issues)
section.

Let's get started by writing a test for a hypothetical function that adds two
numbers. First, create a `sum.js` file:

Expand Down Expand Up @@ -96,23 +101,16 @@ page.

### Using Babel

To use [Babel](http://babeljs.io/), install the `babel-jest` and
`regenerator-runtime` packages:
[Babel](http://babeljs.io/) is automatically handled by Jest using `babel-jest`.
You don't need install anything extra for using Babel.

```bash
npm install --save-dev babel-jest babel-core regenerator-runtime
```

> Note: If you are using a babel version 7 then you need to install `babel-jest`
> with the following command:
> Note: If you are using a babel version 7 then you need to install
> `babel-core@^7.0.0-0` and `@babel/core` with the following command:
>
> ```bash
> npm install --save-dev babel-jest 'babel-core@^7.0.0-0' @babel/core regenerator-runtime
> npm install --save-dev 'babel-core@^7.0.0-0' @babel/core
> ```
_Note: Explicitly installing `regenerator-runtime` is not needed if you use
`npm` 3 or 4 or Yarn_

Don't forget to add a [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) file
in your project's root folder. For example, if you are using ES6 and
[React.js](https://facebook.github.io/react/) with the
Expand Down
7 changes: 6 additions & 1 deletion docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ option to `jasmine1` or pass `--testRunner=jasmine1` as a command line option.
Jest takes advantage of new features added to Node 6. We recommend that you
upgrade to the latest stable release of Node. The minimum supported version is
`v6.0.0`. Versions `0.x.x` and `4.x.x` are not supported.
`v6.0.0`. Versions `0.x.x` and `4.x.x` are not supported because the `jsdom`
version used in Jest doesn't support Node 4. However, if you need to run Jest on
Node 4, you can use the `testEnvironment` config to use a
[custom environment](https://facebook.github.io/jest/docs/en/configuration.html#testenvironment-string)
that supports Node 4, such as
[`jest-environment-node`](https://www.npmjs.com/package/jest-environment-node).

### `coveragePathIgnorePatterns` seems to not have any effect.

Expand Down
18 changes: 18 additions & 0 deletions integration-tests/__tests__/require_main.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

'use strict';

const runJest = require('../runJest');

test('provides `require.main` set to test suite module', () => {
const {stderr, stdout} = runJest('require-main');
expect(stdout).not.toMatch('No tests found');
expect(stderr).toMatch(/PASS __tests__(\/|\\+)loader\.test\.js/);
});
13 changes: 13 additions & 0 deletions integration-tests/require-main/__tests__/loader.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';

const loader = require('../loader');

test('loader should load a module', () => {
expect(loader('../example.js')).toBeTruthy();
});
8 changes: 8 additions & 0 deletions integration-tests/require-main/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = true;
11 changes: 11 additions & 0 deletions integration-tests/require-main/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const path = require('path');

module.exports = function load(moduleId) {
return require(path.join(path.dirname(require.main.filename), moduleId));
};
5 changes: 5 additions & 0 deletions integration-tests/require-main/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"testEnvironment": "node"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.5.1",
"version": "22.3.0",
"version": "22.4.0",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion packages/babel-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "babel-jest",
"description": "Jest plugin to use babel for transformation.",
"version": "22.2.2",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
8 changes: 4 additions & 4 deletions packages/expect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expect",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,10 +10,10 @@
"browser": "build-es5/index.js",
"dependencies": {
"ansi-styles": "^3.2.0",
"jest-diff": "^22.1.0",
"jest-diff": "^22.4.0",
"jest-get-type": "^22.1.0",
"jest-matcher-utils": "^22.2.0",
"jest-message-util": "^22.2.0",
"jest-matcher-utils": "^22.4.0",
"jest-message-util": "^22.4.0",
"jest-regex-util": "^22.1.0"
}
}
14 changes: 7 additions & 7 deletions packages/jest-circus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-circus",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,13 +9,13 @@
"main": "build/index.js",
"dependencies": {
"chalk": "^2.0.1",
"expect": "^22.3.0",
"jest-diff": "^22.1.0",
"jest-matcher-utils": "^22.2.0",
"jest-message-util": "^22.2.0",
"jest-snapshot": "^22.2.0"
"expect": "^22.4.0",
"jest-diff": "^22.4.0",
"jest-matcher-utils": "^22.4.0",
"jest-message-util": "^22.4.0",
"jest-snapshot": "^22.4.0"
},
"devDependencies": {
"jest-runtime": "^22.3.0"
"jest-runtime": "^22.4.0"
}
}
20 changes: 10 additions & 10 deletions packages/jest-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jest-cli",
"description": "Delightful JavaScript Testing.",
"version": "22.3.0",
"version": "22.4.0",
"main": "build/jest.js",
"dependencies": {
"ansi-escapes": "^3.0.0",
Expand All @@ -16,18 +16,18 @@
"istanbul-lib-instrument": "^1.8.0",
"istanbul-lib-source-maps": "^1.2.1",
"jest-changed-files": "^22.2.0",
"jest-config": "^22.3.0",
"jest-environment-jsdom": "^22.3.0",
"jest-config": "^22.4.0",
"jest-environment-jsdom": "^22.4.0",
"jest-get-type": "^22.1.0",
"jest-haste-map": "^22.3.0",
"jest-message-util": "^22.2.0",
"jest-haste-map": "^22.4.0",
"jest-message-util": "^22.4.0",
"jest-regex-util": "^22.1.0",
"jest-resolve-dependencies": "^22.1.0",
"jest-runner": "^22.3.0",
"jest-runtime": "^22.3.0",
"jest-snapshot": "^22.2.0",
"jest-util": "^22.3.0",
"jest-validate": "^22.2.2",
"jest-runner": "^22.4.0",
"jest-runtime": "^22.4.0",
"jest-snapshot": "^22.4.0",
"jest-util": "^22.4.0",
"jest-validate": "^22.4.0",
"jest-worker": "^22.2.2",
"micromatch": "^2.3.11",
"node-notifier": "^5.2.1",
Expand Down
16 changes: 8 additions & 8 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-config",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,14 +10,14 @@
"dependencies": {
"chalk": "^2.0.1",
"glob": "^7.1.1",
"jest-environment-jsdom": "^22.3.0",
"jest-environment-node": "^22.3.0",
"jest-environment-jsdom": "^22.4.0",
"jest-environment-node": "^22.4.0",
"jest-get-type": "^22.1.0",
"jest-jasmine2": "^22.3.0",
"jest-jasmine2": "^22.4.0",
"jest-regex-util": "^22.1.0",
"jest-resolve": "^22.3.0",
"jest-util": "^22.3.0",
"jest-validate": "^22.2.2",
"pretty-format": "^22.1.0"
"jest-resolve": "^22.4.0",
"jest-util": "^22.4.0",
"jest-validate": "^22.4.0",
"pretty-format": "^22.4.0"
}
}
4 changes: 2 additions & 2 deletions packages/jest-diff/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-diff",
"version": "22.1.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -11,6 +11,6 @@
"chalk": "^2.0.1",
"diff": "^3.2.0",
"jest-get-type": "^22.1.0",
"pretty-format": "^22.1.0"
"pretty-format": "^22.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/jest-docblock/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-docblock",
"version": "22.2.2",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-editor-support/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-editor-support",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,7 +10,7 @@
"dependencies": {
"babel-traverse": "^6.14.1",
"babylon": "^6.14.1",
"jest-snapshot": "^22.2.0"
"jest-snapshot": "^22.4.0"
},
"typings": "index.d.ts"
}
4 changes: 2 additions & 2 deletions packages/jest-environment-jsdom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-environment-jsdom",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,7 +9,7 @@
"main": "build/index.js",
"dependencies": {
"jest-mock": "^22.2.0",
"jest-util": "^22.3.0",
"jest-util": "^22.4.0",
"jsdom": "^11.5.1"
}
}
4 changes: 2 additions & 2 deletions packages/jest-environment-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-environment-node",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -9,6 +9,6 @@
"main": "build/index.js",
"dependencies": {
"jest-mock": "^22.2.0",
"jest-util": "^22.3.0"
"jest-util": "^22.4.0"
}
}
6 changes: 3 additions & 3 deletions packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-haste-map",
"version": "22.3.0",
"version": "22.4.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
Expand All @@ -10,8 +10,8 @@
"dependencies": {
"fb-watchman": "^2.0.0",
"graceful-fs": "^4.1.11",
"jest-docblock": "^22.2.2",
"jest-serializer": "^22.3.0",
"jest-docblock": "^22.4.0",
"jest-serializer": "^22.4.0",
"jest-worker": "^22.2.2",
"micromatch": "^2.3.11",
"sane": "^2.0.0"
Expand Down
Loading

0 comments on commit e7ccbc6

Please sign in to comment.