Skip to content

Commit c949669

Browse files
authored
Merge branch 'main' into patch-2
2 parents 575bc01 + bc26cd7 commit c949669

File tree

2,528 files changed

+87711
-22635
lines changed

Some content is hidden

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

2,528 files changed

+87711
-22635
lines changed

.circleci/config.yml

Lines changed: 2 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/[email protected].0
15+
node: circleci/[email protected].3
1616

1717
jobs:
1818
test-node:
@@ -58,5 +58,5 @@ workflows:
5858
name: test-node-partial-<< matrix.node-version >>
5959
matrix:
6060
parameters:
61-
node-version: ['14', '16', '18']
61+
node-version: ['14', '16', '18', '19']
6262
- test-jest-jasmine

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ bin/
55
packages/*/build/**
66
packages/*/dist/**
77
website/.docusaurus
8-
website/blog
98
website/build
109
website/node_modules
1110
website/i18n/*.js

.eslintplugin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

.eslintrc.cjs

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -162,14 +162,36 @@ module.exports = {
162162
],
163163
env: {'jest/globals': true},
164164
excludedFiles: ['**/__typetests__/**'],
165+
extends: ['plugin:jest/style'],
165166
plugins: ['jest'],
166167
rules: {
168+
'jest/no-alias-methods': 'error',
167169
'jest/no-focused-tests': 'error',
168170
'jest/no-identical-title': 'error',
171+
'jest/require-to-throw-message': 'error',
169172
'jest/valid-expect': 'error',
170173
},
171174
},
172175

176+
{
177+
files: ['e2e/__tests__/*'],
178+
rules: {
179+
'jest/no-restricted-jest-methods': [
180+
'error',
181+
{
182+
fn: 'Please use fixtures instead of mocks in the end-to-end tests.',
183+
mock: 'Please use fixtures instead of mocks in the end-to-end tests.',
184+
doMock:
185+
'Please use fixtures instead of mocks in the end-to-end tests.',
186+
setMock:
187+
'Please use fixtures instead of mocks in the end-to-end tests.',
188+
spyOn:
189+
'Please use fixtures instead of mocks in the end-to-end tests.',
190+
},
191+
],
192+
},
193+
},
194+
173195
// to make it more suitable for running on code examples in docs/ folder
174196
{
175197
files: ['**/*.md/**'],
@@ -178,19 +200,50 @@ module.exports = {
178200
'@typescript-eslint/no-empty-function': 'off',
179201
'@typescript-eslint/no-namespace': 'off',
180202
'@typescript-eslint/no-empty-interface': 'off',
181-
'arrow-body-style': 'off',
182203
'consistent-return': 'off',
183204
'import/export': 'off',
184205
'import/no-extraneous-dependencies': 'off',
185206
'import/no-unresolved': 'off',
186207
'jest/no-focused-tests': 'off',
208+
'jest/require-to-throw-message': 'off',
187209
'no-console': 'off',
188210
'no-undef': 'off',
189211
'no-unused-vars': 'off',
190-
'prettier/prettier': 'off',
191212
'sort-keys': 'off',
192213
},
193214
},
215+
// demonstration of matchers usage
216+
{
217+
files: ['**/UsingMatchers.md/**'],
218+
rules: {
219+
'jest/prefer-to-be': 'off',
220+
},
221+
},
222+
// demonstration of 'jest/valid-expect' rule
223+
{
224+
files: [
225+
'**/2017-05-06-jest-20-delightful-testing-multi-project-runner.md/**',
226+
],
227+
rules: {
228+
'jest/valid-expect': 'off',
229+
},
230+
},
231+
// Jest 11 did not had `toHaveLength` matcher
232+
{
233+
files: ['**/2016-04-12-jest-11.md/**'],
234+
rules: {
235+
'jest/prefer-to-have-length': 'off',
236+
},
237+
},
238+
// snapshot in an example needs to keep escapes
239+
{
240+
files: [
241+
'**/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md/**',
242+
],
243+
rules: {
244+
'no-useless-escape': 'off',
245+
},
246+
},
194247

195248
// snapshots in examples plus inline snapshots need to keep backtick
196249
{
@@ -216,8 +269,7 @@ module.exports = {
216269
{
217270
files: ['examples/**/*'],
218271
rules: {
219-
'import/no-unresolved': ['error', {ignore: ['^react-native$']}],
220-
'import/order': 'off',
272+
'no-restricted-imports': 'off',
221273
},
222274
},
223275
{
@@ -333,7 +385,7 @@ module.exports = {
333385
parserOptions: {
334386
sourceType: 'module',
335387
},
336-
plugins: ['import'],
388+
plugins: ['import', 'jsdoc'],
337389
rules: {
338390
'accessor-pairs': ['warn', {setWithoutGet: true}],
339391
'block-scoped-var': 'off',
@@ -390,6 +442,7 @@ module.exports = {
390442
},
391443
],
392444
'init-declarations': 'off',
445+
'jsdoc/check-alignment': 'error',
393446
'lines-around-comment': 'off',
394447
'max-depth': 'off',
395448
'max-nested-callbacks': 'off',

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ updates:
44
directory: /
55
schedule:
66
interval: daily
7+
- package-ecosystem: npm
8+
directory: /
9+
schedule:
10+
interval: daily

.github/workflows/close-stale.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 'Close stale issues and PRs'
22
on:
33
schedule:
4-
- cron: '*/10 * * * *'
4+
- cron: '0 * * * *'
55

66
permissions:
77
issues: write # to close stale issues (actions/stale)
@@ -12,7 +12,7 @@ jobs:
1212
name: 'Close month old issues and PRs'
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/stale@v6
15+
- uses: actions/stale@v8
1616
with:
1717
start-date: '2022-01-01T00:00:00Z'
1818
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.'
@@ -25,13 +25,14 @@ jobs:
2525
days-before-pr-close: 30
2626
exempt-all-milestones: true
2727
exempt-issue-labels: Pinned
28+
exempt-pr-labels: Pinned
2829
exempt-draft-pr: true
2930
operations-per-run: 1750
3031
stale-legacy:
3132
name: 'Close year old issues and PRs'
3233
runs-on: ubuntu-latest
3334
steps:
34-
- uses: actions/stale@v6
35+
- uses: actions/stale@v8
3536
with:
3637
stale-issue-message: 'This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.'
3738
stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.'
@@ -43,4 +44,5 @@ jobs:
4344
days-before-pr-close: 30
4445
exempt-all-milestones: true
4546
exempt-issue-labels: Pinned
47+
exempt-pr-labels: Pinned
4648
operations-per-run: 1750

.github/workflows/lock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: dessant/lock-threads@v3
16+
- uses: dessant/lock-threads@v4
1717
with:
1818
github-token: ${{ github.token }}
1919
issue-inactive-days: '30'

.github/workflows/nodejs.yml

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636

3737
steps:
3838
- uses: actions/checkout@v3
39+
with:
40+
persist-credentials: false
3941
- uses: actions/setup-node@v3
4042
with:
4143
node-version: lts/*
@@ -50,6 +52,30 @@ jobs:
5052
run: yarn test-ts --selectProjects type-tests
5153
- name: verify [email protected] compatibility
5254
run: yarn verify-old-ts
55+
- name: run ESLint with type info
56+
run: yarn lint-ts-files
57+
58+
typecheck:
59+
name: Typecheck Examples and Tests
60+
runs-on: ubuntu-latest
61+
needs: prepare-yarn-cache-ubuntu
62+
63+
steps:
64+
- uses: actions/checkout@v3
65+
with:
66+
persist-credentials: false
67+
- uses: actions/setup-node@v3
68+
with:
69+
node-version: lts/*
70+
cache: yarn
71+
- name: install
72+
run: yarn --immutable
73+
- name: build
74+
run: yarn build:ts
75+
- name: typecheck examples
76+
run: yarn typecheck:examples
77+
- name: typecheck tests
78+
run: yarn typecheck:tests
5379

5480
lint:
5581
name: Lint
@@ -58,6 +84,8 @@ jobs:
5884

5985
steps:
6086
- uses: actions/checkout@v3
87+
with:
88+
persist-credentials: false
6189
- uses: actions/setup-node@v3
6290
with:
6391
node-version: lts/*
@@ -72,6 +100,8 @@ jobs:
72100
run: yarn lint
73101
- name: run prettier
74102
run: yarn lint:prettier:ci
103+
- name: check changelog
104+
run: yarn check-changelog
75105
- name: check copyright headers
76106
run: yarn check-copyright-headers
77107

@@ -81,6 +111,8 @@ jobs:
81111
needs: prepare-yarn-cache-ubuntu
82112
steps:
83113
- uses: actions/checkout@v3
114+
with:
115+
persist-credentials: false
84116
- uses: actions/setup-node@v3
85117
with:
86118
node-version: lts/*
@@ -106,6 +138,27 @@ jobs:
106138
with:
107139
os: windows-latest
108140

141+
test-leak:
142+
name: Node LTS on Ubuntu with leak detection
143+
runs-on: ubuntu-latest
144+
needs: prepare-yarn-cache-ubuntu
145+
146+
steps:
147+
- uses: actions/checkout@v3
148+
with:
149+
persist-credentials: false
150+
- name: Use Node.js LTS
151+
uses: actions/setup-node@v3
152+
with:
153+
node-version: lts/*
154+
cache: yarn
155+
- name: install
156+
run: yarn --immutable
157+
- name: build
158+
run: yarn build:js
159+
- name: run tests with leak detection
160+
run: yarn test-leak
161+
109162
test-coverage:
110163
name: Node LTS on Ubuntu with coverage (${{ matrix.shard }})
111164
strategy:
@@ -117,6 +170,8 @@ jobs:
117170

118171
steps:
119172
- uses: actions/checkout@v3
173+
with:
174+
persist-credentials: false
120175
- name: Use Node.js LTS
121176
uses: actions/setup-node@v3
122177
with:
@@ -130,9 +185,7 @@ jobs:
130185
id: cpu-cores
131186
uses: SimenB/github-actions-cpu-cores@v1
132187
- name: run tests with coverage
133-
run: |
134-
yarn jest-coverage --color --config jest.config.ci.mjs --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
135-
yarn test-leak
188+
run: yarn jest-coverage --color --config jest.config.ci.mjs --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
136189
- name: map coverage
137190
run: node ./scripts/mapCoverage.mjs
138191
if: always()

.github/workflows/prepare-cache.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v3
17+
with:
18+
persist-credentials: false
1719

1820
- uses: actions/setup-node@v3
1921
with:

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
node-version: [14.x, 16.x, 18.x]
15+
node-version: [14.x, 16.x, 18.x, 19.x]
1616
shard: ['1/4', '2/4', '3/4', '4/4']
1717
name: Node v${{ matrix.node-version }} on ${{ inputs.os }} (${{ matrix.shard }})
1818
runs-on: ${{ inputs.os }}
1919

2020
steps:
2121
- uses: actions/checkout@v3
22+
with:
23+
persist-credentials: false
2224
- name: Use Node.js ${{ matrix.node-version }}
2325
uses: actions/setup-node@v3
2426
with:
@@ -44,6 +46,8 @@ jobs:
4446

4547
steps:
4648
- uses: actions/checkout@v3
49+
with:
50+
persist-credentials: false
4751
- name: Use Node.js LTS
4852
uses: actions/setup-node@v3
4953
with:

0 commit comments

Comments
 (0)