Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolson authored May 12, 2024
2 parents 333223a + 32b966f commit 84a7b0c
Show file tree
Hide file tree
Showing 77 changed files with 375 additions and 467 deletions.
444 changes: 222 additions & 222 deletions .yarn/releases/yarn-3.8.1.cjs → .yarn/releases/yarn-3.8.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.8.1.cjs
yarnPath: .yarn/releases/yarn-3.8.2.cjs
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- `[@jest/core]` Support `--outputFile` option for [`--listTests`](https://jestjs.io/docs/cli#--listtests) ([#14980](https://github.com/jestjs/jest/pull/14980))
- `[@jest/core, @jest/test-sequencer]` [**BREAKING**] Exposes `globalConfig` & `contexts` to `TestSequencer` ([#14535](https://github.com/jestjs/jest/pull/14535), & [#14543](https://github.com/jestjs/jest/pull/14543))
- `[@jest/environment]` [**BREAKING**] Remove deprecated `jest.genMockFromModule()` ([#15042](https://github.com/jestjs/jest/pull/15042))
- `[@jest/environment]` [**BREAKING**] Remove unnecessary defensive code ([#15045](https://github.com/jestjs/jest/pull/15045))
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade JSDOM to v22 ([#13825](https://github.com/jestjs/jest/pull/13825))
- `[@jest/environment-jsdom-abstract]` Introduce new package which abstracts over the `jsdom` environment, allowing usage of custom versions of JSDOM ([#14717](https://github.com/jestjs/jest/pull/14717))
- `[jest-environment-node]` Update jest environment with dispose symbols `Symbol` ([#14888](https://github.com/jestjs/jest/pull/14888) & [#14909](https://github.com/jestjs/jest/pull/14909))
Expand All @@ -39,6 +40,9 @@

- `[babel-plugin-jest-hoist]` Use `denylist` instead of the deprecated `blacklist` for Babel 8 support ([#14109](https://github.com/jestjs/jest/pull/14109))
- `[expect]` Check error instance type for `toThrow/toThrowError` ([#14576](https://github.com/jestjs/jest/pull/14576))
- `[expect]` Improve diff for failing `expect.objectContaining` ([#15038](https://github.com/jestjs/jest/pull/15038))
- `[jest-changed-files]` Print underlying errors when VCS commands fail ([#15052](https://github.com/jestjs/jest/pull/15052))
- `[jest-changed-files]` Abort `sl root` call if output resembles a steam locomotive ([#15053](https://github.com/jestjs/jest/pull/15053))
- `[jest-circus]` [**BREAKING**] Prevent false test failures caused by promise rejections handled asynchronously ([#14315](https://github.com/jestjs/jest/pull/14315))
- `[jest-circus]` Replace recursive `makeTestResults` implementation with iterative one ([#14760](https://github.com/jestjs/jest/pull/14760))
- `[jest-circus]` Omit `expect.hasAssertions()` errors if a test already has errors ([#14866](https://github.com/jestjs/jest/pull/14866))
Expand Down
48 changes: 1 addition & 47 deletions e2e/__tests__/testEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

import {tmpdir} from 'os';
import * as path from 'path';
import slash = require('slash');
import {cleanup, createEmptyPackage, writeFiles} from '../Utils';
import runJest, {json as runWithJson} from '../runJest';
import {json as runWithJson} from '../runJest';
import * as testFixturePackage from '../test-environment/package.json';

const DIR = path.resolve(tmpdir(), 'test-env-no-mocked');

beforeEach(() => cleanup(DIR));
afterAll(() => cleanup(DIR));

it('respects testEnvironment docblock', () => {
expect(testFixturePackage.jest.testEnvironment).toBe('node');

Expand All @@ -25,40 +16,3 @@ it('respects testEnvironment docblock', () => {
expect(result.success).toBe(true);
expect(result.numTotalTests).toBe(4);
});

it('handles missing `mocked` property', () => {
createEmptyPackage(DIR);
writeFiles(DIR, {
'env.js': `
const Node = require('${slash(
require.resolve('jest-environment-node'),
)}').default;
module.exports = class Thing extends Node {
constructor(...args) {
super(...args);
this.moduleMocker.mocked = undefined;
}
};
`,
'test.js': `
/**
* @jest-environment ./env.js
*/
jest.mocked();
test('halla', () => {
expect(globalThis.thing).toBe('nope');
});
`,
});

const {exitCode, stderr} = runJest(DIR);

expect(exitCode).toBe(1);
expect(stderr).toContain(
'Your test environment does not support `mocked`, please update it.',
);
});
6 changes: 3 additions & 3 deletions e2e/async-regenerator/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/babel-plugin-jest-hoist/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1405,9 +1405,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/coverage-transform-instrumented/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/global-setup/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1559,9 +1559,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/global-teardown/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1559,9 +1559,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/native-esm/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ __metadata:
linkType: hard

"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0":
version: 10.2.1
resolution: "lru-cache@npm:10.2.1"
checksum: ae81586eaeb92389fc9a05790d7efd424a29334daa4e513196d6e138a069d0afad1738cfa67773f05b9cb8666fb076f8af88a1b5cc4c7e569202f18a0c032a35
version: 10.2.2
resolution: "lru-cache@npm:10.2.2"
checksum: 98e8fc93691c546f719a76103ef2bee5a3ac823955c755a47641ec41f8c7fafa1baeaba466937cc1cbfa9cfd47e03536d10e2db3158a64ad91ff3a58a32c893e
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/transform/multiple-transformers/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1510,9 +1510,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/transform/transform-snapshotResolver/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1369,9 +1369,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/transform/transform-testrunner/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
6 changes: 3 additions & 3 deletions e2e/transform/transformer-config/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001613
resolution: "caniuse-lite@npm:1.0.30001613"
checksum: 909bae9083aecd4b7488d39b66f454448f52a64bceab4f512720775bcff16aa00124fc3439ee76b1e3bb5b795ea54a7cc9a5ece0affa31c07657447cf198a9e2
version: 1.0.30001614
resolution: "caniuse-lite@npm:1.0.30001614"
checksum: 1b695625f9a1b08584c3c229d4b8deaebb89e7901a2a2ffe599a6250c0a79fc61afc49c374c32a76dbf593a5dedac3229bb0140bbacd438276211bdd1d7c4958
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"syncWorkspaceLock": true
}
},
"version": "30.0.0-alpha.3"
"version": "30.0.0-alpha.4"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,5 @@
"psl": "patch:psl@npm:^1.9.0#./.yarn/patches/psl-npm-1.9.0-a546edad1a.patch",
"ts-node@^10.5.0": "patch:ts-node@npm:^10.5.0#./.yarn/patches/ts-node-npm-10.9.1-6c268be7f4.patch"
},
"packageManager": "yarn@3.8.1"
"packageManager": "yarn@3.8.2"
}
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": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-jest-hoist",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-jest",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-jest",
"description": "Create a new Jest project",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/diff-sequences/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "diff-sequences",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/expect-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jest/expect-utils",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expect",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2176,13 +2176,13 @@ exports[`.toEqual() {pass: false} expect({"a": 1, "b": 2}).toEqual(ObjectContain
<d>expect(</><r>received</><d>).</>toEqual<d>(</><g>expected</><d>) // deep equality</>

<g>- Expected - 2</>
<r>+ Received + 3</>
<r>+ Received + 2</>

<g>- ObjectContaining {</>
<g>- "a": 2,</>
<r>+ Object {</>
<r>+ "a": 1,</>
<r>+ "b": 2,</>
<d> "b": 2,</>
<d> }</>
`;

Expand Down
8 changes: 8 additions & 0 deletions packages/expect/src/asymmetricMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,19 @@ class ObjectContaining extends AsymmetricMatcher<
const matcherContext = this.getMatcherContext();
const objectKeys = getObjectKeys(this.sample);

const otherKeys = other ? getObjectKeys(other) : [];

for (const key of objectKeys) {
if (
!hasProperty(other, key) ||
!equals(this.sample[key], other[key], matcherContext.customTesters)
) {
// Result has already been determined, mutation only affects diff output
for (const key of otherKeys) {
if (!hasProperty(this.sample, key)) {
this.sample[key] = other[key];
}
}
result = false;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-changed-files/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-changed-files",
"version": "30.0.0-alpha.3",
"version": "30.0.0-alpha.4",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
Expand Down
15 changes: 1 addition & 14 deletions packages/jest-changed-files/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,14 @@
*/

import * as path from 'path';
import {types} from 'util';
import execa = require('execa');
import type {SCMAdapter} from './types';

const findChangedFilesUsingCommand = async (
args: Array<string>,
cwd: string,
): Promise<Array<string>> => {
let result: execa.ExecaReturnValue;

try {
result = await execa('git', args, {cwd});
} catch (error) {
if (types.isNativeError(error)) {
const err = error as execa.ExecaError;
// TODO: Should we keep the original `message`?
err.message = err.stderr;
}

throw error;
}
const result = await execa('git', args, {cwd});

return result.stdout
.split('\n')
Expand Down
15 changes: 1 addition & 14 deletions packages/jest-changed-files/src/hg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import * as path from 'path';
import {types} from 'util';
import execa = require('execa');
import type {SCMAdapter} from './types';

Expand All @@ -30,19 +29,7 @@ const adapter: SCMAdapter = {
}
args.push(...includePaths);

let result: execa.ExecaReturnValue;

try {
result = await execa('hg', args, {cwd, env});
} catch (error) {
if (types.isNativeError(error)) {
const err = error as execa.ExecaError;
// TODO: Should we keep the original `message`?
err.message = err.stderr;
}

throw error;
}
const result = await execa('hg', args, {cwd, env});

return result.stdout
.split('\n')
Expand Down
Loading

0 comments on commit 84a7b0c

Please sign in to comment.