Skip to content

Commit

Permalink
Merge branch 'master' into first
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 8, 2020
2 parents b3be275 + c808901 commit d5e2a5e
Show file tree
Hide file tree
Showing 58 changed files with 569 additions and 593 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,12 +4,21 @@

### Fixes

- `[jest-validate]` Show suggestion only when unrecognized cli param is longer than 1 character ([#10604](https://github.com/facebook/jest/pull/10604))
- `[jest-validate]` Validate `testURL` as CLI option ([#10595](https://github.com/facebook/jest/pull/10595))

### Chore & Maintenance

### Performance

## 26.5.2

### Fixes

- `[*]` Revert usage of Escalade and rollback Yargs to v15 as it breaks Node 13 ([#10599](https://github.com/facebook/jest/pull/10599))
- `[jest-circus]` Setup globals before emitting `setup`, and include Jest globals in the `setup` payload ([#10598](https://github.com/facebook/jest/pull/10598))
- `[jest-mock]` Fix typings for `mockResolvedValue`, `mockResolvedValueOnce`, `mockRejectedValue` and `mockRejectedValueOnce` ([#10600](https://github.com/facebook/jest/pull/10600))

## 26.5.1

### Fixes
Expand Down
1 change: 1 addition & 0 deletions TestUtils.ts
Expand Up @@ -83,6 +83,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = {
globalTeardown: undefined,
globals: {},
haste: {},
injectGlobals: true,
moduleDirectories: [],
moduleFileExtensions: ['js'],
moduleLoader: '/test_module_loader_path',
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"version": "26.5.1",
"version": "26.5.2",
"npmClient": "yarn",
"packages": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -82,7 +82,7 @@
"which": "^2.0.1"
},
"scripts": {
"build-clean": "rimraf './packages/*/build' './packages/*/build-es5' './packages/*/tsconfig.tsbuildinfo'",
"build-clean": "rimraf './packages/*/build' './packages/*/tsconfig.tsbuildinfo'",
"build": "yarn build:js && yarn build:ts",
"build:js": "node ./scripts/build.js",
"build:ts": "node ./scripts/buildTs.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-jest/package.json
@@ -1,7 +1,7 @@
{
"name": "babel-jest",
"description": "Jest plugin to use babel for transformation.",
"version": "26.5.0",
"version": "26.5.2",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -11,8 +11,8 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/transform": "^26.5.0",
"@jest/types": "^26.5.0",
"@jest/transform": "^26.5.2",
"@jest/types": "^26.5.2",
"@types/babel__core": "^7.1.7",
"babel-plugin-istanbul": "^6.0.0",
"babel-preset-jest": "^26.5.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/expect/package.json
@@ -1,6 +1,6 @@
{
"name": "expect",
"version": "26.5.0",
"version": "26.5.2",
"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.5.0",
"@jest/types": "^26.5.2",
"ansi-styles": "^4.0.0",
"jest-get-type": "^26.3.0",
"jest-matcher-utils": "^26.5.0",
"jest-message-util": "^26.5.0",
"jest-matcher-utils": "^26.5.2",
"jest-message-util": "^26.5.2",
"jest-regex-util": "^26.0.0"
},
"devDependencies": {
Expand Down
18 changes: 0 additions & 18 deletions packages/expect/src/__tests__/fakeChalk.test.ts

This file was deleted.

23 changes: 0 additions & 23 deletions packages/expect/src/fakeChalk.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/jest-changed-files/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-changed-files",
"version": "26.5.0",
"version": "26.5.2",
"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.5.0",
"@jest/types": "^26.5.2",
"execa": "^4.0.0",
"throat": "^5.0.0"
},
Expand Down
26 changes: 13 additions & 13 deletions packages/jest-circus/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-circus",
"version": "26.5.1",
"version": "26.5.2",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -11,24 +11,24 @@
"types": "build/index.d.ts",
"dependencies": {
"@babel/traverse": "^7.1.0",
"@jest/environment": "^26.5.0",
"@jest/test-result": "^26.5.0",
"@jest/types": "^26.5.0",
"@jest/environment": "^26.5.2",
"@jest/test-result": "^26.5.2",
"@jest/types": "^26.5.2",
"@types/babel__traverse": "^7.0.4",
"@types/node": "*",
"chalk": "^4.0.0",
"co": "^4.6.0",
"dedent": "^0.7.0",
"expect": "^26.5.0",
"expect": "^26.5.2",
"is-generator-fn": "^2.0.0",
"jest-each": "^26.5.0",
"jest-matcher-utils": "^26.5.0",
"jest-message-util": "^26.5.0",
"jest-runner": "^26.5.1",
"jest-runtime": "^26.5.0",
"jest-snapshot": "^26.5.0",
"jest-util": "^26.5.0",
"pretty-format": "^26.5.0",
"jest-each": "^26.5.2",
"jest-matcher-utils": "^26.5.2",
"jest-message-util": "^26.5.2",
"jest-runner": "^26.5.2",
"jest-runtime": "^26.5.2",
"jest-snapshot": "^26.5.2",
"jest-util": "^26.5.2",
"pretty-format": "^26.5.2",
"stack-utils": "^2.0.2",
"throat": "^5.0.0"
},
Expand Down
18 changes: 2 additions & 16 deletions packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import * as path from 'path';
import type {Config} from '@jest/types';
import type {JestEnvironment} from '@jest/environment';
import type {TestResult} from '@jest/test-result';
Expand All @@ -14,8 +13,7 @@ import type {RuntimeType as Runtime} from 'jest-runtime';
import type {SnapshotStateType} from 'jest-snapshot';
import {deepCyclicCopy} from 'jest-util';

const FRAMEWORK_INITIALIZER = path.resolve(__dirname, './jestAdapterInit.js');
const EXPECT_INITIALIZER = path.resolve(__dirname, './jestExpect.js');
const FRAMEWORK_INITIALIZER = require.resolve('./jestAdapterInit');

const jestAdapter = async (
globalConfig: Config.GlobalConfig,
Expand All @@ -32,10 +30,6 @@ const jestAdapter = async (
FRAMEWORK_INITIALIZER,
);

const expect = runtime
.requireInternalModule<typeof import('./jestExpect')>(EXPECT_INITIALIZER)
.default(globalConfig);

const getPrettier = () =>
config.prettierPath ? require(config.prettierPath) : null;
const getBabelTraverse = () => require('@babel/traverse').default;
Expand All @@ -49,18 +43,10 @@ const jestAdapter = async (
localRequire: runtime.requireModule.bind(runtime),
parentProcess: process,
sendMessageToJest,
setGlobalsForRuntime: runtime.setGlobalsForRuntime?.bind(runtime),
testPath,
});

const runtimeGlobals = {expect, ...globals};
// TODO: `jest-circus` might be newer than `jest-runtime` - remove `?.` for Jest 27
runtime.setGlobalsForRuntime?.(runtimeGlobals);

// TODO: `jest-circus` might be newer than `jest-config` - remove `??` for Jest 27
if (config.injectGlobals ?? true) {
Object.assign(environment.global, runtimeGlobals);
}

if (config.timers === 'fake' || config.timers === 'legacy') {
// during setup, this cannot be null (and it's fine to explode if it is)
environment.fakeTimers!.useFakeTimers();
Expand Down
Expand Up @@ -35,9 +35,14 @@ import {getTestID} from '../utils';
import run from '../run';
import testCaseReportHandler from '../testCaseReportHandler';
import globals from '..';
import createExpect, {Expect} from './jestExpect';

type Process = NodeJS.Process;

interface JestGlobals extends Global.TestFrameworkGlobals {
expect: Expect;
}

export const initialize = async ({
config,
environment,
Expand All @@ -46,8 +51,9 @@ export const initialize = async ({
globalConfig,
localRequire,
parentProcess,
testPath,
sendMessageToJest,
setGlobalsForRuntime,
testPath,
}: {
config: Config.ProjectConfig;
environment: JestEnvironment;
Expand All @@ -58,6 +64,7 @@ export const initialize = async ({
testPath: Config.Path;
parentProcess: Process;
sendMessageToJest?: TestFileEvent;
setGlobalsForRuntime?: (globals: JestGlobals) => void;
}): Promise<{
globals: Global.TestFrameworkGlobals;
snapshotState: SnapshotStateType;
Expand Down Expand Up @@ -120,9 +127,22 @@ export const initialize = async ({
addEventHandler(environment.handleTestEvent.bind(environment));
}

const runtimeGlobals: JestGlobals = {
...globalsObject,
expect: createExpect(globalConfig),
};
// TODO: `jest-circus` might be newer than `jest-runtime` - remove `?.` for Jest 27
setGlobalsForRuntime?.(runtimeGlobals);

// TODO: `jest-circus` might be newer than `jest-config` - remove `??` for Jest 27
if (config.injectGlobals ?? true) {
Object.assign(environment.global, runtimeGlobals);
}

await dispatch({
name: 'setup',
parentProcess,
runtimeGlobals,
testNamePattern: globalConfig.testNamePattern,
});

Expand Down
Expand Up @@ -16,7 +16,9 @@ import {
toThrowErrorMatchingSnapshot,
} from 'jest-snapshot';

export default (config: Pick<Config.GlobalConfig, 'expand'>): typeof expect => {
export type Expect = typeof expect;

export default (config: Pick<Config.GlobalConfig, 'expand'>): Expect => {
expect.setState({expand: config.expand});
expect.extend({
toMatchInlineSnapshot,
Expand Down
16 changes: 8 additions & 8 deletions packages/jest-cli/package.json
@@ -1,23 +1,23 @@
{
"name": "jest-cli",
"description": "Delightful JavaScript Testing.",
"version": "26.5.0",
"version": "26.5.2",
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/core": "^26.5.0",
"@jest/test-result": "^26.5.0",
"@jest/types": "^26.5.0",
"@jest/core": "^26.5.2",
"@jest/test-result": "^26.5.2",
"@jest/types": "^26.5.2",
"chalk": "^4.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
"import-local": "^3.0.2",
"is-ci": "^2.0.0",
"jest-config": "^26.5.0",
"jest-util": "^26.5.0",
"jest-validate": "^26.5.0",
"jest-config": "^26.5.2",
"jest-util": "^26.5.2",
"jest-validate": "^26.5.2",
"prompts": "^2.0.1",
"yargs": "^16.0.3"
"yargs": "^15.4.1"
},
"devDependencies": {
"@jest/test-utils": "^26.5.0",
Expand Down
22 changes: 11 additions & 11 deletions packages/jest-config/package.json
@@ -1,6 +1,6 @@
{
"name": "jest-config",
"version": "26.5.0",
"version": "26.5.2",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
Expand All @@ -11,23 +11,23 @@
"types": "build/index.d.ts",
"dependencies": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^26.5.0",
"@jest/types": "^26.5.0",
"babel-jest": "^26.5.0",
"@jest/test-sequencer": "^26.5.2",
"@jest/types": "^26.5.2",
"babel-jest": "^26.5.2",
"chalk": "^4.0.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.1",
"graceful-fs": "^4.2.4",
"jest-environment-jsdom": "^26.5.0",
"jest-environment-node": "^26.5.0",
"jest-environment-jsdom": "^26.5.2",
"jest-environment-node": "^26.5.2",
"jest-get-type": "^26.3.0",
"jest-jasmine2": "^26.5.0",
"jest-jasmine2": "^26.5.2",
"jest-regex-util": "^26.0.0",
"jest-resolve": "^26.5.0",
"jest-util": "^26.5.0",
"jest-validate": "^26.5.0",
"jest-resolve": "^26.5.2",
"jest-util": "^26.5.2",
"jest-validate": "^26.5.2",
"micromatch": "^4.0.2",
"pretty-format": "^26.5.0"
"pretty-format": "^26.5.2"
},
"devDependencies": {
"@types/babel__core": "^7.0.4",
Expand Down

0 comments on commit d5e2a5e

Please sign in to comment.