Skip to content

Commit

Permalink
Merge branch 'master' into per-test-report
Browse files Browse the repository at this point in the history
  • Loading branch information
kunal-kushwaha committed Jun 23, 2020
2 parents 71965e4 + 817d8b6 commit 241581f
Show file tree
Hide file tree
Showing 78 changed files with 597 additions and 338 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/question.md
@@ -1,7 +1,7 @@
---
name: 💬 Questions / Help
label: ':speech_balloon: Question'
about: If you have questions, please check our Discord or StackOverflow
about: If you have questions, please check Reactiflux or StackOverflow
---

<!-- Love Jest? Please consider supporting our collective: 👉 https://opencollective.com/jest/donate -->
Expand All @@ -13,5 +13,5 @@ about: If you have questions, please check our Discord or StackOverflow
For questions or help please see:

- [The Jest help page](https://jestjs.io/en/help.html)
- [Our discord channel in Reactiflux](https://discord.gg/MWRhKCj)
- [Our `#testing` channel in Reactiflux](https://www.reactiflux.com/)
- The [jestjs](https://stackoverflow.com/questions/tagged/jestjs) tag on [StackOverflow](https://stackoverflow.com/questions/ask)
2 changes: 1 addition & 1 deletion .github/SUPPORT.md
@@ -1,3 +1,3 @@
Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jest) or our [discord channel](https://discord.gg/MWRhKCj) for questions.
Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jest) or [Reactiflux](https://www.reactiflux.com/) for questions.

<!-- Love Jest? Please consider supporting our collective: 👉 https://opencollective.com/jest/donate -->
16 changes: 16 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,17 @@

### Features

### Fixes

### Chore & Maintenance

### Performance

## 26.1.0

### Features

- `[jest-mock]` Export `Mock`, `MockInstance`, `SpyInstance` types ([#10138](https://github.com/facebook/jest/pull/10138))
- `[jest-config]` Support config files exporting (`async`) `function`s ([#10001](https://github.com/facebook/jest/pull/10001))
- `[jest-cli, jest-core]` Add `--selectProjects` CLI argument to filter test suites by project name ([#8612](https://github.com/facebook/jest/pull/8612))
- `[jest-cli, jest-init]` Add `coverageProvider` to `jest --init` prompts ([#10044](https://github.com/facebook/jest/pull/10044))
Expand All @@ -19,9 +30,14 @@
- `[jest-core]` 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉 ([#10000](https://github.com/facebook/jest/pull/10000))
- `[jest-core, jest-reporters, jest-test-result, jest-types]` Cleanup `displayName` type ([#10049](https://github.com/facebook/jest/pull/10049))
- `[jest-runtime]` Jest-internal sandbox escape hatch ([#9907](https://github.com/facebook/jest/pull/9907))
- `[jest-fake-timers]` Update `now` param type to support `Date` in addition to `number`. ([#10169](https://github.com/facebook/jest/pull/10169))
- `[docs]` Add param to `setSystemTime` docs and remove preceding period from it and `getRealSystemTime` ([#10169](https://github.com/facebook/jest/pull/10169))
- `[jest-snapshot, jest-util]` Replace `make-dir` with `fs.mkdir` ([#10136](https://github.com/facebook/jest/pull/10136))

### Performance

- `[jest-core, jest-transform, jest-haste-map]` Improve Jest startup time and test runtime, particularly when running with coverage, by caching micromatch and avoiding recreating RegExp instances ([#10131](https://github.com/facebook/jest/pull/10131))

## 26.0.1

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -211,7 +211,7 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe

## How to Get in Touch

- Discord - [#jest](https://discord.gg/MWRhKCj) on [Reactiflux](http://www.reactiflux.com/)
`#testing` on [Reactiflux](https://www.reactiflux.com/)

## Code Conventions

Expand Down
2 changes: 1 addition & 1 deletion docs/ExpectAPI.md
Expand Up @@ -495,7 +495,7 @@ expect.addSnapshotSerializer(serializer);
// affects expect(value).toMatchSnapshot() assertions in the test file
```

If you add a snapshot serializer in individual test files instead of to adding it to `snapshotSerializers` configuration:
If you add a snapshot serializer in individual test files instead of adding it to `snapshotSerializers` configuration:

- You make the dependency explicit instead of implicit.
- You avoid limits to configuration that might cause you to eject from [create-react-app](https://github.com/facebookincubator/create-react-app).
Expand Down
2 changes: 1 addition & 1 deletion docs/GlobalAPI.md
Expand Up @@ -3,7 +3,7 @@ id: api
title: Globals
---

In your test files, Jest puts each of these methods and objects into the global environment. You don't have to require or import anything to use them. However, if you prefer explicit imports, you can do `import {describe, expect, it} from '@jest/globals'`.
In your test files, Jest puts each of these methods and objects into the global environment. You don't have to require or import anything to use them. However, if you prefer explicit imports, you can do `import {describe, expect, test} from '@jest/globals'`.

## Methods

Expand Down
4 changes: 2 additions & 2 deletions docs/JestObjectAPI.md
Expand Up @@ -647,13 +647,13 @@ This means, if any timers have been scheduled (but have not yet executed), they

Returns the number of fake timers still left to run.

### `.jest.setSystemTime()`
### `jest.setSystemTime(now?: number | Date)`

Set the current system time used by fake timers. Simulates a user changing the system clock while your program is running. It affects the current time but it does not in itself cause e.g. timers to fire; they will fire exactly as they would have done without the call to `jest.setSystemTime()`.

> Note: This function is only available when using modern fake timers implementation
### `.jest.getRealSystemTime()`
### `jest.getRealSystemTime()`

When mocking time, `Date.now()` will also be mocked. If you for some reason need access to the real current time, you can invoke this function.

Expand Down
2 changes: 1 addition & 1 deletion docs/MoreResources.md
Expand Up @@ -19,6 +19,6 @@ You will find a number of example test cases in the [`examples`](https://github.

## Join the community

Ask questions and find answers from other Jest users like you. [Reactiflux](http://www.reactiflux.com/) is a Discord chat where a lot of Jest discussion happens. Check out the [#jest](https://discord.gg/MWRhKCj) channel.
Ask questions and find answers from other Jest users like you. [Reactiflux](https://www.reactiflux.com/) is a Discord chat where a lot of Jest discussion happens. Check out the `#testing` channel.

Follow the [Jest Twitter account](https://twitter.com/fbjest) and [blog](/blog/) to find out what's happening in the world of Jest.
2 changes: 1 addition & 1 deletion docs/UsingMatchers.md
Expand Up @@ -138,7 +138,7 @@ test('the shopping list has beer on it', () => {

## Exceptions

If you want to test that a particular function throws an error when it's called, use `toThrow`.
If you want to test whether a particular function throws an error when it's called, use `toThrow`.

```js
function compileAndroidCode() {
Expand Down
13 changes: 6 additions & 7 deletions e2e/Utils.ts
Expand Up @@ -11,7 +11,6 @@ import type {Config} from '@jest/types';

// eslint-disable-next-line import/named
import {ExecaReturnValue, sync as spawnSync} from 'execa';
import makeDir = require('make-dir');
import rimraf = require('rimraf');
import dedent = require('dedent');
import which = require('which');
Expand Down Expand Up @@ -46,7 +45,7 @@ export const linkJestPackage = (packageName: string, cwd: Config.Path) => {
const packagesDir = path.resolve(__dirname, '../packages');
const packagePath = path.resolve(packagesDir, packageName);
const destination = path.resolve(cwd, 'node_modules/', packageName);
makeDir.sync(destination);
fs.mkdirSync(destination, {recursive: true});
rimraf.sync(destination);
fs.symlinkSync(packagePath, destination, 'junction');
};
Expand Down Expand Up @@ -77,12 +76,12 @@ export const writeFiles = (
directory: string,
files: {[filename: string]: string},
) => {
makeDir.sync(directory);
fs.mkdirSync(directory, {recursive: true});
Object.keys(files).forEach(fileOrPath => {
const dirname = path.dirname(fileOrPath);

if (dirname !== '/') {
makeDir.sync(path.join(directory, dirname));
fs.mkdirSync(path.join(directory, dirname), {recursive: true});
}
fs.writeFileSync(
path.resolve(directory, ...fileOrPath.split('/')),
Expand All @@ -95,13 +94,13 @@ export const writeSymlinks = (
directory: string,
symlinks: {[existingFile: string]: string},
) => {
makeDir.sync(directory);
fs.mkdirSync(directory, {recursive: true});
Object.keys(symlinks).forEach(fileOrPath => {
const symLinkPath = symlinks[fileOrPath];
const dirname = path.dirname(symLinkPath);

if (dirname !== '/') {
makeDir.sync(path.join(directory, dirname));
fs.mkdirSync(path.join(directory, dirname), {recursive: true});
}
fs.symlinkSync(
path.resolve(directory, ...fileOrPath.split('/')),
Expand Down Expand Up @@ -165,7 +164,7 @@ export const createEmptyPackage = (
},
};

makeDir.sync(directory);
fs.mkdirSync(directory, {recursive: true});
packageJson || (packageJson = DEFAULT_PACKAGE_JSON);
fs.writeFileSync(
path.resolve(directory, 'package.json'),
Expand Down
12 changes: 11 additions & 1 deletion e2e/modern-fake-timers/from-config/__tests__/test.js
Expand Up @@ -7,7 +7,7 @@

'use strict';

test('fake timers', () => {
test('fake timers with number argument', () => {
jest.setSystemTime(0);

expect(Date.now()).toBe(0);
Expand All @@ -16,3 +16,13 @@ test('fake timers', () => {

expect(Date.now()).toBe(1000);
});

test('fake timers with Date argument', () => {
jest.setSystemTime(new Date(0));

expect(Date.now()).toBe(0);

jest.setSystemTime(new Date(1000));

expect(Date.now()).toBe(1000);
});
14 changes: 13 additions & 1 deletion e2e/modern-fake-timers/from-jest-object/__tests__/test.js
Expand Up @@ -7,7 +7,7 @@

'use strict';

test('fake timers', () => {
test('fake timers with number argument', () => {
jest.useFakeTimers('modern');

jest.setSystemTime(0);
Expand All @@ -18,3 +18,15 @@ test('fake timers', () => {

expect(Date.now()).toBe(1000);
});

test('fake timers with Date argument', () => {
jest.useFakeTimers('modern');

jest.setSystemTime(new Date(0));

expect(Date.now()).toBe(0);

jest.setSystemTime(new Date(1000));

expect(Date.now()).toBe(1000);
});
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"version": "26.0.1",
"version": "26.1.0",
"npmClient": "yarn",
"packages": [
"packages/*"
Expand Down
9 changes: 4 additions & 5 deletions package.json
Expand Up @@ -59,7 +59,6 @@
"jest-watch-typeahead": "^0.5.0",
"jquery": "^3.2.1",
"lerna": "^3.20.2",
"make-dir": "^3.0.0",
"micromatch": "^4.0.2",
"mock-fs": "^4.4.1",
"opencollective": "^1.0.3",
Expand All @@ -78,12 +77,12 @@
"which": "^2.0.1"
},
"scripts": {
"build-clean": "rimraf ./packages/*/build ./packages/*/build-es5 ./packages/*/tsconfig.tsbuildinfo",
"prebuild": "yarn build:ts",
"build": "node ./scripts/build.js",
"build-clean": "rimraf './packages/*/build' './packages/*/build-es5' './packages/*/tsconfig.tsbuildinfo'",
"build": "yarn build:js && yarn build:ts",
"build:js": "node ./scripts/build.js",
"build:ts": "node ./scripts/buildTs.js",
"check-copyright-headers": "node ./scripts/checkCopyrightHeaders.js",
"clean-all": "yarn clean-e2e && yarn build-clean && rimraf ./packages/*/node_modules && rimraf ./node_modules",
"clean-all": "yarn clean-e2e && yarn build-clean && rimraf './packages/*/node_modules' && rimraf './node_modules'",
"clean-e2e": "node ./scripts/cleanE2e.js",
"jest": "node ./packages/jest-cli/bin/jest.js",
"jest-coverage": "yarn jest --coverage",
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-jest/package.json
@@ -1,7 +1,7 @@
{
"name": "babel-jest",
"description": "Jest plugin to use babel for transformation.",
"version": "26.0.1",
"version": "26.1.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -11,11 +11,11 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/transform": "^26.0.1",
"@jest/types": "^26.0.1",
"@jest/transform": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/babel__core": "^7.1.7",
"babel-plugin-istanbul": "^6.0.0",
"babel-preset-jest": "^26.0.0",
"babel-preset-jest": "^26.1.0",
"chalk": "^4.0.0",
"graceful-fs": "^4.2.4",
"slash": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/package.json
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-jest-hoist",
"version": "26.0.0",
"version": "26.1.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,6 +1,6 @@
{
"name": "babel-preset-jest",
"version": "26.0.0",
"version": "26.1.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -9,7 +9,7 @@
"license": "MIT",
"main": "index.js",
"dependencies": {
"babel-plugin-jest-hoist": "^26.0.0",
"babel-plugin-jest-hoist": "^26.1.0",
"babel-preset-current-node-syntax": "^0.1.2"
},
"peerDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/expect/package.json
@@ -1,6 +1,6 @@
{
"name": "expect",
"version": "26.0.1",
"version": "26.1.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -10,11 +10,11 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/types": "^26.0.1",
"@jest/types": "^26.1.0",
"ansi-styles": "^4.0.0",
"jest-get-type": "^26.0.0",
"jest-matcher-utils": "^26.0.1",
"jest-message-util": "^26.0.1",
"jest-matcher-utils": "^26.1.0",
"jest-message-util": "^26.1.0",
"jest-regex-util": "^26.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-changed-files/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-changed-files",
"version": "26.0.1",
"version": "26.1.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -10,7 +10,7 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/types": "^26.0.1",
"@jest/types": "^26.1.0",
"execa": "^4.0.0",
"throat": "^5.0.0"
},
Expand Down
24 changes: 12 additions & 12 deletions packages/jest-circus/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-circus",
"version": "26.0.1",
"version": "26.1.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -11,21 +11,21 @@
"types": "build/index.d.ts",
"dependencies": {
"@babel/traverse": "^7.1.0",
"@jest/environment": "^26.0.1",
"@jest/test-result": "^26.0.1",
"@jest/types": "^26.0.1",
"@jest/environment": "^26.1.0",
"@jest/test-result": "^26.1.0",
"@jest/types": "^26.1.0",
"chalk": "^4.0.0",
"co": "^4.6.0",
"dedent": "^0.7.0",
"expect": "^26.0.1",
"expect": "^26.1.0",
"is-generator-fn": "^2.0.0",
"jest-each": "^26.0.1",
"jest-matcher-utils": "^26.0.1",
"jest-message-util": "^26.0.1",
"jest-runtime": "^26.0.1",
"jest-snapshot": "^26.0.1",
"jest-util": "^26.0.1",
"pretty-format": "^26.0.1",
"jest-each": "^26.1.0",
"jest-matcher-utils": "^26.1.0",
"jest-message-util": "^26.1.0",
"jest-runtime": "^26.1.0",
"jest-snapshot": "^26.1.0",
"jest-util": "^26.1.0",
"pretty-format": "^26.1.0",
"stack-utils": "^2.0.2",
"throat": "^5.0.0"
},
Expand Down

0 comments on commit 241581f

Please sign in to comment.