Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b57de1f

Browse files
committed
Merge branch 'main' into patch
2 parents cddd949 + 00ef0ed commit b57de1f

File tree

1,008 files changed

+25224
-84430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,008 files changed

+25224
-84430
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ aliases:
1212
app-dir: ~/jest
1313

1414
orbs:
15-
node: circleci/node@5.0.3
15+
node: circleci/node@5.1.0
1616

1717
jobs:
1818
test-node:
@@ -58,5 +58,6 @@ workflows:
5858
name: test-node-partial-<< matrix.node-version >>
5959
matrix:
6060
parameters:
61-
node-version: ['14', '16', '18', '19']
61+
# For some reason, v20 fails to run yarn install…
62+
node-version: ['16', '18']
6263
- test-jest-jasmine

.eslintrc.cjs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ module.exports = {
4040
},
4141
overrides: [
4242
{
43-
extends: [
44-
'plugin:@typescript-eslint/recommended',
45-
'plugin:@typescript-eslint/eslint-recommended',
46-
'plugin:import/typescript',
47-
],
43+
extends: ['plugin:@typescript-eslint/strict', 'plugin:import/typescript'],
4844
files: ['*.ts', '*.tsx'],
4945
plugins: ['@typescript-eslint/eslint-plugin', 'local'],
5046
rules: {
@@ -61,9 +57,18 @@ module.exports = {
6157
'consistent-return': 'off',
6258
'no-dupe-class-members': 'off',
6359
'no-unused-vars': 'off',
60+
'@typescript-eslint/no-dynamic-delete': 'off',
6461
// TODO: enable at some point
6562
'@typescript-eslint/no-explicit-any': 'off',
6663
'@typescript-eslint/no-non-null-assertion': 'off',
64+
'@typescript-eslint/no-invalid-void-type': 'off',
65+
66+
// TODO: part of "stylistic" rules, remove explicit activation when that lands
67+
'@typescript-eslint/no-empty-function': 'error',
68+
'@typescript-eslint/no-empty-interface': 'error',
69+
70+
// not needed to be enforced for TS
71+
'import/namespace': 'off',
6772
},
6873
},
6974
{
@@ -128,7 +133,7 @@ module.exports = {
128133
rules: {
129134
'@typescript-eslint/ban-types': [
130135
'error',
131-
// TODO: remove these overrides: https://github.com/facebook/jest/issues/10177
136+
// TODO: remove these overrides: https://github.com/jestjs/jest/issues/10177
132137
{types: {Function: false, object: false, '{}': false}},
133138
],
134139
'local/ban-types-eventually': [
@@ -158,6 +163,7 @@ module.exports = {
158163
'e2e/failures/macros.js',
159164
'e2e/test-in-root/*.js',
160165
'e2e/test-match/test-suites/*',
166+
'e2e/test-match-default/dot-spec-tests/*',
161167
'packages/test-utils/src/ConditionalTest.ts',
162168
],
163169
env: {'jest/globals': true},
@@ -347,6 +353,8 @@ module.exports = {
347353
files: ['**/__typetests__/**'],
348354
rules: {
349355
'@typescript-eslint/no-empty-function': 'off',
356+
'@typescript-eslint/no-invalid-void-type': 'off',
357+
'@typescript-eslint/no-useless-constructor': 'off',
350358
},
351359
},
352360
{
@@ -357,7 +365,7 @@ module.exports = {
357365
files: [
358366
'scripts/*',
359367
'packages/*/__benchmarks__/test.js',
360-
'packages/jest-cli/src/init/index.ts',
368+
'packages/create-jest/src/runCreate.ts',
361369
'packages/jest-repl/src/cli/runtime-cli.ts',
362370
],
363371
rules: {
@@ -374,6 +382,7 @@ module.exports = {
374382
'**/__typetests__/**',
375383
],
376384
rules: {
385+
'@typescript-eslint/no-extraneous-class': 'off',
377386
'@typescript-eslint/no-unused-vars': 'off',
378387
'import/no-unresolved': 'off',
379388
'no-console': 'off',
@@ -385,7 +394,7 @@ module.exports = {
385394
parserOptions: {
386395
sourceType: 'module',
387396
},
388-
plugins: ['import', 'jsdoc'],
397+
plugins: ['import', 'jsdoc', 'unicorn'],
389398
rules: {
390399
'accessor-pairs': ['warn', {setWithoutGet: true}],
391400
'block-scoped-var': 'off',
@@ -590,6 +599,14 @@ module.exports = {
590599
'wrap-iife': 'off',
591600
'wrap-regex': 'off',
592601
yoda: 'off',
602+
603+
'unicorn/explicit-length-check': 'error',
604+
'unicorn/no-array-for-each': 'error',
605+
'unicorn/no-negated-condition': 'error',
606+
'unicorn/numeric-separators-style': 'error',
607+
'unicorn/prefer-default-parameters': 'error',
608+
'unicorn/prefer-includes': 'error',
609+
'unicorn/template-indent': 'error',
593610
},
594611
settings: {
595612
'import/ignore': ['react-native'],

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 👉 [Please follow one of these issue templates](https://github.com/facebook/jest/issues/new/choose) 👈
1+
## 👉 [Please follow one of these issue templates](https://github.com/jestjs/jest/issues/new/choose) 👈
22

33
<!-- Love Jest? Please consider supporting our collective: 👉 https://opencollective.com/jest/donate -->
44

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ body:
4141
label: Version
4242
description: |
4343
The version of Jest you are using.
44-
Is it the [latest](https://github.com/facebook/jest/releases)? Test and see if the bug has already been fixed.
44+
Is it the [latest](https://github.com/jestjs/jest/releases)? Test and see if the bug has already been fixed.
4545
placeholder: ex. 27.0.6
4646
validations:
4747
required: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Documentation 📖
2+
description: Submit a request to add or update documentation
3+
title: '[Docs]: '
4+
labels: ['Documentation :book:']
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
### Thank you for helping us improve our documentation!
10+
11+
Please be sure you are looking at [the latest version of the documentation](https://jestjs.io/docs) before opening an issue here.
12+
- type: textarea
13+
id: links
14+
attributes:
15+
label: Page(s)
16+
description: |
17+
Links to one or more documentation pages that should be modified.
18+
If you are reporting an issue with a specific section of a page, try to link directly to the nearest anchor.
19+
If you are suggesting that a new page be created, link to the parent of the proposed page.
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: description
24+
attributes:
25+
label: Description
26+
description: |
27+
Describe the change you are requesting.
28+
If the issue pertains to a single function or matcher, be sure to specify the entire call signature.
29+
validations:
30+
required: true

.github/dependabot.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/renovate.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base"],
4+
"lockFileMaintenance": {"enabled": true, "automerge": false},
5+
"rangeStrategy": "replace",
6+
"postUpdateOptions": ["yarnDedupeHighest"],
7+
"packageRules": [
8+
{
9+
"matchPackageNames": ["@tsd/typescript", "typescript"],
10+
"groupName": "typescript"
11+
},
12+
{
13+
"matchPackageNames": ["jest-runner-tsd", "tsd-lite"],
14+
"groupName": "tsd"
15+
}
16+
]
17+
}

.github/workflows/issues.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ jobs:
1212
name: Questions
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Close Issue
16-
uses: peter-evans/close-issue@v2
17-
if: "${{ github.event.label.name == ':speech_balloon: Question' }}"
18-
with:
19-
comment: Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jestjs) or our [discord channel](https://discord.gg/j6FKKQQrW9) for questions.
15+
- if: "${{ github.event.label.name == ':speech_balloon: Question' }}"
16+
run: gh issue close $ISSUE --comment "Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jestjs) or our [discord channel](https://discord.gg/j6FKKQQrW9) for questions."
17+
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
ISSUE: ${{ github.event.issue.html_url }}
2020
bug-without-repro:
2121
name: Bug reports without reproductions
2222
runs-on: ubuntu-latest
2323
steps:
24-
- name: Close Issue
25-
uses: peter-evans/close-issue@v2
26-
if: "${{ github.event.label.name == 'Needs Reproduction' }}"
27-
with:
28-
comment: As noted in the [Bug Report template](https://github.com/facebook/jest/blob/main/.github/ISSUE_TEMPLATE/bug.yml), all bug reports requires a minimal reproduction. Please open up a new issue providing one. Read more at https://stackoverflow.com/help/minimal-reproducible-example.
24+
- if: "${{ github.event.label.name == 'Needs Reproduction' }}"
25+
run: gh issue close $ISSUE --comment "As noted in the [Bug Report template](https://github.com/jestjs/jest/blob/main/.github/ISSUE_TEMPLATE/bug.yml), all bug reports requires a minimal reproduction. Please open up a new issue providing one. Read more at https://stackoverflow.com/help/minimal-reproducible-example."
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
ISSUE: ${{ github.event.issue.html_url }}

.github/workflows/nightly.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Node Nightly CI
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 12 * * *'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read # to fetch code (actions/checkout)
14+
issues: write # to create an issue and comment in it
15+
16+
jobs:
17+
prepare-yarn-cache-ubuntu:
18+
uses: ./.github/workflows/prepare-cache.yml
19+
with:
20+
os: ubuntu-latest
21+
prepare-yarn-cache-macos:
22+
uses: ./.github/workflows/prepare-cache.yml
23+
with:
24+
os: macos-latest
25+
prepare-yarn-cache-windows:
26+
uses: ./.github/workflows/prepare-cache.yml
27+
with:
28+
os: windows-latest
29+
30+
test-ubuntu:
31+
uses: ./.github/workflows/test-nightly.yml
32+
needs: prepare-yarn-cache-ubuntu
33+
with:
34+
os: ubuntu-latest
35+
test-macos:
36+
uses: ./.github/workflows/test-nightly.yml
37+
needs: prepare-yarn-cache-macos
38+
with:
39+
os: macos-latest
40+
test-windows:
41+
uses: ./.github/workflows/test-nightly.yml
42+
needs: prepare-yarn-cache-windows
43+
with:
44+
os: windows-latest
45+
notify:
46+
name: Notify failed build
47+
needs: [test-ubuntu, test-macos, test-windows]
48+
if: failure()
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: jayqi/failed-build-issue-action@v1
52+
with:
53+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/nodejs.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
branches:
66
- main
77
pull_request:
8-
branches:
9-
- '**'
8+
merge_group:
109

1110
concurrency:
1211
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -35,7 +34,7 @@ jobs:
3534
needs: prepare-yarn-cache-ubuntu
3635

3736
steps:
38-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3938
with:
4039
persist-credentials: false
4140
- uses: actions/setup-node@v3
@@ -50,7 +49,7 @@ jobs:
5049
run: yarn test-ts --selectProjects ts-integration
5150
- name: type tests
5251
run: yarn test-ts --selectProjects type-tests
53-
- name: verify TypeScript@4.3 compatibility
52+
- name: verify TypeScript@5.0 compatibility
5453
run: yarn verify-old-ts
5554
- name: run ESLint with type info
5655
run: yarn lint-ts-files
@@ -61,7 +60,7 @@ jobs:
6160
needs: prepare-yarn-cache-ubuntu
6261

6362
steps:
64-
- uses: actions/checkout@v3
63+
- uses: actions/checkout@v4
6564
with:
6665
persist-credentials: false
6766
- uses: actions/setup-node@v3
@@ -83,7 +82,7 @@ jobs:
8382
needs: prepare-yarn-cache-ubuntu
8483

8584
steps:
86-
- uses: actions/checkout@v3
85+
- uses: actions/checkout@v4
8786
with:
8887
persist-credentials: false
8988
- uses: actions/setup-node@v3
@@ -110,7 +109,7 @@ jobs:
110109
runs-on: ubuntu-latest
111110
needs: prepare-yarn-cache-ubuntu
112111
steps:
113-
- uses: actions/checkout@v3
112+
- uses: actions/checkout@v4
114113
with:
115114
persist-credentials: false
116115
- uses: actions/setup-node@v3
@@ -125,26 +124,44 @@ jobs:
125124
test-ubuntu:
126125
uses: ./.github/workflows/test.yml
127126
needs: prepare-yarn-cache-ubuntu
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
shard: ['1/4', '2/4', '3/4', '4/4']
131+
name: Ubuntu with shard ${{ matrix.shard }}
128132
with:
129133
os: ubuntu-latest
134+
shard: ${{ matrix.shard }}
130135
test-macos:
131136
uses: ./.github/workflows/test.yml
132137
needs: prepare-yarn-cache-macos
138+
strategy:
139+
fail-fast: false
140+
matrix:
141+
shard: ['1/3', '2/3', '3/3']
142+
name: macOS with shard ${{ matrix.shard }}
133143
with:
134144
os: macos-latest
145+
shard: ${{ matrix.shard }}
135146
test-windows:
136147
uses: ./.github/workflows/test.yml
137148
needs: prepare-yarn-cache-windows
149+
strategy:
150+
fail-fast: false
151+
matrix:
152+
shard: ['1/4', '2/4', '3/4', '4/4']
153+
name: Windows with shard ${{ matrix.shard }}
138154
with:
139155
os: windows-latest
156+
shard: ${{ matrix.shard }}
140157

141158
test-leak:
142159
name: Node LTS on Ubuntu with leak detection
143160
runs-on: ubuntu-latest
144161
needs: prepare-yarn-cache-ubuntu
145162

146163
steps:
147-
- uses: actions/checkout@v3
164+
- uses: actions/checkout@v4
148165
with:
149166
persist-credentials: false
150167
- name: Use Node.js LTS
@@ -169,7 +186,7 @@ jobs:
169186
needs: prepare-yarn-cache-ubuntu
170187

171188
steps:
172-
- uses: actions/checkout@v3
189+
- uses: actions/checkout@v4
173190
with:
174191
persist-credentials: false
175192
- name: Use Node.js LTS
@@ -183,7 +200,7 @@ jobs:
183200
run: yarn build:js
184201
- name: Get number of CPU cores
185202
id: cpu-cores
186-
uses: SimenB/github-actions-cpu-cores@v1
203+
uses: SimenB/github-actions-cpu-cores@v2
187204
- name: run tests with coverage
188205
run: yarn jest-coverage --color --config jest.config.ci.mjs --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
189206
- name: map coverage

0 commit comments

Comments
 (0)