Skip to content

Commit

Permalink
Merge branch 'main' into move-off-alias-methods-2
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Oct 27, 2023
2 parents c4a5bbf + 924992a commit 1d48e3d
Show file tree
Hide file tree
Showing 27 changed files with 920 additions and 441 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ workflows:
name: test-node-partial-<< matrix.node-version >>
matrix:
parameters:
# For some reason, v20 fails to run yarn install…
node-version: ['16', '18']
node-version: ['16', '18', '20', '21']
- test-jest-jasmine
12 changes: 6 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand All @@ -63,7 +63,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand All @@ -85,7 +85,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand All @@ -112,7 +112,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand All @@ -190,7 +190,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
persist-credentials: false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 21-nightly
cache: yarn
Expand All @@ -48,7 +48,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 21-nightly
cache: yarn
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x, 21.x]
name: Node v${{ matrix.node-version }}
runs-on: ${{ inputs.os }}

Expand All @@ -24,7 +24,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand All @@ -47,7 +47,7 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))
- `[docs]` Fix typos in `CHANGELOG.md` and `packages/jest-validate/README.md` ([#14640](https://github.com/jestjs/jest/pull/14640))
- `[docs]` Don't use alias matchers in docs ([#14631](https://github.com/facebook/jest/pull/14631))

## 29.7.0
Expand Down Expand Up @@ -635,7 +636,7 @@

### Fixes

- `[*]` Use `sha256` instead of `md5` as hashing algortihm for compatibility with FIPS systems ([#12722](https://github.com/facebook/jest/pull/12722))
- `[*]` Use `sha256` instead of `md5` as hashing algorithm for compatibility with FIPS systems ([#12722](https://github.com/facebook/jest/pull/12722))
- `[babel-jest]` [**BREAKING**] Pass `rootDir` as `root` in Babel's options ([#12689](https://github.com/facebook/jest/pull/12689))
- `[expect]` Move typings of `.not`, `.rejects` and `.resolves` modifiers outside of `Matchers` interface ([#12346](https://github.com/facebook/jest/pull/12346))
- `[expect]` Throw useful error if `expect.extend` is called with invalid matchers ([#12488](https://github.com/facebook/jest/pull/12488))
Expand Down Expand Up @@ -1442,7 +1443,7 @@
- `[*]` Upgrade to chalk@4 ([#9752](https://github.com/facebook/jest/pull/9752))
- `[*]` Remove usage of `realpath-native` ([#9952](https://github.com/facebook/jest/pull/9952))
- `[docs]` Fix example reference implementation to use Jest with Phabricator ([#8662](https://github.com/facebook/jest/pull/8662))
- `[docs]` Added default compiler to tranform ([#8583](https://github.com/facebook/jest/pull/8583))
- `[docs]` Added default compiler to transform ([#8583](https://github.com/facebook/jest/pull/8583))
- `[docs]` Updated Testing Frameworks guide with React; make it generic ([#9106](https://github.com/facebook/jest/pull/9106))
- `[expect, jest-mock, pretty-format]` [**BREAKING**] Remove `build-es5` from package ([#9945](https://github.com/facebook/jest/pull/9945))
- `[@jest/fake-timers, @jest/environment]` [**BREAKING**] Rename `LolexFakeTimers` to `ModernFakeTimers` ([#9960](https://github.com/facebook/jest/pull/9960))
Expand Down Expand Up @@ -3482,7 +3483,7 @@ See <https://jestjs.io/blog/2016/12/15/2016-in-jest>
- Added `--watchAll`, made `--watch` interactive and added the ability to update snapshots and select test patterns in watch mode.
- Jest uses verbose mode when running a single test file.
- Console messages are now buffered and printed along with the test results.
- Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module colision when using `jsdom` as test environment.
- Fix `testEnvironment` resolution to prefer `jest-environment-{name}` instead of `{name}` only. This prevents a module collision when using `jsdom` as test environment.
- `moduleNameMapper` now uses a resolution algorithm.
- Improved performance for small test runs.
- Improved API documentation.
Expand Down Expand Up @@ -3621,7 +3622,7 @@ See <https://jestjs.io/blog/2016/12/15/2016-in-jest>
- Clear the terminal window when using `--watch`.
- By default, `--watch` will now only runs tests related to changed files. `--watch=all` can be used to run all tests on file system changes.
- Debounce `--watch` re-runs to not trigger test runs during a branch switch in version control.
- Added `jest.fn()` and `jest.fn(implementation)` as convenient shorcuts for `jest.genMockFunction()` and `jest.genMockFunction().mockImplementation()`.
- Added `jest.fn()` and `jest.fn(implementation)` as convenient shortcuts for `jest.genMockFunction()` and `jest.genMockFunction().mockImplementation()`.
- Added an `automock` option to turn off automocking globally.
- Added a "no tests found" message if no tests can be found.
- Jest sets `process.NODE_ENV` to `test` unless otherwise specified.
Expand Down
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
publish = "/website/build"

[build.environment]
NODE_VERSION = "16"
NODE_VERSION = "20"
NODE_OPTIONS = "--max_old_space_size=4096"
# default cache
YARN_ENABLE_GLOBAL_CACHE = "true"
YARN_GLOBAL_FOLDER = "/opt/buildhome/.yarn_cache"
YARN_CACHE_FOLDER = "/opt/buildhome/.yarn_cache"
YARN_VERSION = "3.3.1"
YARN_VERSION = "3.6.4"

[context.production]
# Do not build the site if there's no site-related changes
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"devDependencies": {
"@tsd/typescript": "^5.0.4",
"@types/graceful-fs": "^4.1.3",
"@types/pnpapi": "^0.0.3",
"@types/pnpapi": "^0.0.4",
"@types/resolve": "^1.20.2",
"tsd-lite": "^0.8.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ import {validate} from 'jest-validate';
validateCLIOptions(argv, {...allowedOptions, deprecatedOptions});
```

If `argv` contains a deprecated option that is not specifid in `allowedOptions`, `validateCLIOptions` will throw an error with the message specified in the `deprecatedOptions` config:
If `argv` contains a deprecated option that is not specified in `allowedOptions`, `validateCLIOptions` will throw an error with the message specified in the `deprecatedOptions` config:

```bash
● collectCoverageOnlyFrom:
Expand All @@ -213,4 +213,4 @@ If `argv` contains a deprecated option that is not specifid in `allowedOptions`,
CLI Options Documentation: https://jestjs.io/docs/en/cli.html
```

If the deprecation option is still listed in the `allowedOptions` config, then `validateCLIOptions` will print the warning wihout throwing an error.
If the deprecation option is still listed in the `allowedOptions` config, then `validateCLIOptions` will print the warning without throwing an error.
2 changes: 1 addition & 1 deletion tsconfig.typetest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node14/tsconfig.json",
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
Expand Down
1 change: 1 addition & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ const config = {
},
image: 'img/opengraph.png',
prism: {
additionalLanguages: ['bash', 'diff', 'json'],
theme: require('./src/prism/themeLight'),
darkTheme: require('./src/prism/themeDark'),
},
Expand Down
17 changes: 9 additions & 8 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
]
},
"dependencies": {
"@docusaurus/core": "^3.0.0-beta.0",
"@docusaurus/plugin-client-redirects": "3.0.0-beta.0",
"@docusaurus/plugin-pwa": "3.0.0-beta.0",
"@docusaurus/preset-classic": "3.0.0-beta.0",
"@docusaurus/remark-plugin-npm2yarn": "3.0.0-beta.0",
"@docusaurus/core": "3.0.0-rc.0",
"@docusaurus/plugin-client-redirects": "3.0.0-rc.0",
"@docusaurus/plugin-pwa": "3.0.0-rc.0",
"@docusaurus/preset-classic": "3.0.0-rc.0",
"@docusaurus/remark-plugin-npm2yarn": "3.0.0-rc.0",
"clsx": "^2.0.0",
"docusaurus-remark-plugin-tab-blocks": "^2.0.0-beta",
"docusaurus-remark-plugin-tab-blocks": "^2.0.0-rc.0",
"prism-react-renderer": "^2.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-github-btn": "^1.3.0",
Expand All @@ -48,8 +49,8 @@
"devDependencies": {
"@babel/core": "^7.11.6",
"@crowdin/cli": "^3.5.2",
"@docusaurus/module-type-aliases": "3.0.0-beta.0",
"@docusaurus/tsconfig": "3.0.0-beta.0",
"@docusaurus/module-type-aliases": "3.0.0-rc.0",
"@docusaurus/tsconfig": "3.0.0-rc.0",
"@types/react": "^18.2.0",
"graphql": "^16.3.0",
"graphql-request": "^6.0.0",
Expand Down
3 changes: 2 additions & 1 deletion website/src/prism/themeDark.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

const baseTheme = require('prism-react-renderer/themes/vsDark');
const {themes} = require('prism-react-renderer');
const baseTheme = themes.vsDark;

const themeDark = [
{
Expand Down
3 changes: 2 additions & 1 deletion website/src/prism/themeLight.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

const baseTheme = require('prism-react-renderer/themes/github');
const {themes} = require('prism-react-renderer');
const baseTheme = themes.github;

const themeLight = [
{
Expand Down
8 changes: 4 additions & 4 deletions website/versioned_docs/version-29.4/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ Check out the section on [Inline Snapshots](SnapshotTesting.md#inline-snapshots)

### `expect.anything()`

`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:
`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:

```js
test('map calls its argument with a non-null argument', () => {
Expand All @@ -900,7 +900,7 @@ test('map calls its argument with a non-null argument', () => {

### `expect.any(constructor)`

`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:
`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:

```js
class Cat {}
Expand Down Expand Up @@ -931,7 +931,7 @@ test('randocall calls its callback with a number', () => {

You can use it instead of a literal value:

- in `toEqual` or `toBeCalledWith`
- in `toEqual` or `toHaveBeenCalledWith`
- to match a property in `objectContaining` or `toMatchObject`

```js
Expand Down Expand Up @@ -1063,7 +1063,7 @@ describe('not.stringContaining', () => {

You can use it instead of a literal value:

- in `toEqual` or `toBeCalledWith`
- in `toEqual` or `toHaveBeenCalledWith`
- to match an element in `arrayContaining`
- to match a property in `objectContaining` or `toMatchObject`

Expand Down
10 changes: 5 additions & 5 deletions website/versioned_docs/version-29.4/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ test('calls the callback after 1 second', () => {
timerGame(callback);

// At this point in time, the callback should not have been called yet
expect(callback).not.toBeCalled();
expect(callback).not.toHaveBeenCalled();

// Fast-forward until all timers have been executed
jest.runAllTimers();

// Now our callback should have been called!
expect(callback).toBeCalled();
expect(callback).toHaveBeenCalled();
expect(callback).toHaveBeenCalledTimes(1);
});
```
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('infiniteTimerGame', () => {
jest.runOnlyPendingTimers();

// At this point, our 1-second timer should have fired its callback
expect(callback).toBeCalled();
expect(callback).toHaveBeenCalled();

// And it should have created a new timer to start the game over in
// 10 seconds
Expand Down Expand Up @@ -154,13 +154,13 @@ it('calls the callback after 1 second via advanceTimersByTime', () => {
timerGame(callback);

// At this point in time, the callback should not have been called yet
expect(callback).not.toBeCalled();
expect(callback).not.toHaveBeenCalled();

// Fast-forward until all timers have been executed
jest.advanceTimersByTime(1000);

// Now our callback should have been called!
expect(callback).toBeCalled();
expect(callback).toHaveBeenCalled();
expect(callback).toHaveBeenCalledTimes(1);
});
```
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.4/TutorialjQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test('displays a user after a click', () => {

// Assert that the fetchCurrentUser function was called, and that the
// #username span's inner text was updated as we'd expect it to.
expect(fetchCurrentUser).toBeCalled();
expect(fetchCurrentUser).toHaveBeenCalled();
expect($('#username').text()).toBe('Johnny Cash - Logged In');
});
```
Expand Down
8 changes: 4 additions & 4 deletions website/versioned_docs/version-29.5/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ Check out the section on [Inline Snapshots](SnapshotTesting.md#inline-snapshots)

### `expect.anything()`

`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:
`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:

```js
test('map calls its argument with a non-null argument', () => {
Expand All @@ -900,7 +900,7 @@ test('map calls its argument with a non-null argument', () => {

### `expect.any(constructor)`

`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:
`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:

```js
class Cat {}
Expand Down Expand Up @@ -931,7 +931,7 @@ test('randocall calls its callback with a number', () => {

You can use it instead of a literal value:

- in `toEqual` or `toBeCalledWith`
- in `toEqual` or `toHaveBeenCalledWith`
- to match a property in `objectContaining` or `toMatchObject`

```js
Expand Down Expand Up @@ -1063,7 +1063,7 @@ describe('not.stringContaining', () => {

You can use it instead of a literal value:

- in `toEqual` or `toBeCalledWith`
- in `toEqual` or `toHaveBeenCalledWith`
- to match an element in `arrayContaining`
- to match a property in `objectContaining` or `toMatchObject`

Expand Down
Loading

0 comments on commit 1d48e3d

Please sign in to comment.