Skip to content

Commit 839964c

Browse files
committed
Merge branch 'main' into main
2 parents 159c4f8 + b55add9 commit 839964c

File tree

641 files changed

+10539
-35700
lines changed

Some content is hidden

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

641 files changed

+10539
-35700
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ workflows:
5454
name: test-node-partial-<< matrix.node-version >>
5555
matrix:
5656
parameters:
57-
node-version: ['12', '14', '16', '17']
57+
node-version: ['12', '14', '16', '17', '18']
5858
- test-jest-jasmine

.eslintignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
!.*
12
**/coverage/**
23
**/node_modules/**
34
bin/
4-
flow-typed/**
55
packages/*/build/**
66
packages/*/dist/**
7-
packages/jest-diff/src/cleanupSemantic.ts
87
website/.docusaurus
98
website/blog
109
website/build
1110
website/node_modules
1211
website/i18n/*.js
1312
website/static
14-
!.eslintrc.js
13+
14+
# Third-party script
15+
packages/jest-diff/src/cleanupSemantic.ts
16+
17+
**/.yarn
18+
**/.pnp.*
19+

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
const {getPackages} = require('./scripts/buildUtils');
8+
const fs = require('fs');
9+
const path = require('path');
10+
const {sync: readPkg} = require('read-pkg');
911

10-
const internalPackages = getPackages()
11-
.map(({pkg}) => pkg.name)
12-
.sort();
12+
function getPackages() {
13+
const PACKAGES_DIR = path.resolve(__dirname, 'packages');
14+
const packages = fs
15+
.readdirSync(PACKAGES_DIR)
16+
.map(file => path.resolve(PACKAGES_DIR, file))
17+
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory());
18+
return packages.map(packageDir => {
19+
const pkg = readPkg({cwd: packageDir});
20+
return pkg.name;
21+
});
22+
}
1323

1424
module.exports = {
1525
env: {
@@ -91,8 +101,6 @@ module.exports = {
91101
'packages/expect/src/print.ts',
92102
'packages/expect/src/toThrowMatchers.ts',
93103
'packages/expect-utils/src/utils.ts',
94-
'packages/jest-core/src/ReporterDispatcher.ts',
95-
'packages/jest-core/src/TestScheduler.ts',
96104
'packages/jest-core/src/collectHandles.ts',
97105
'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts',
98106
'packages/jest-haste-map/src/index.ts',
@@ -176,12 +184,6 @@ module.exports = {
176184
'import/order': 'off',
177185
},
178186
},
179-
{
180-
files: 'packages/jest-types/**/*',
181-
rules: {
182-
'import/no-extraneous-dependencies': 'off',
183-
},
184-
},
185187
{
186188
files: 'packages/**/*.ts',
187189
rules: {
@@ -235,10 +237,12 @@ module.exports = {
235237
},
236238
{
237239
files: [
240+
'e2e/**',
238241
'website/**',
242+
'**/__benchmarks__/**',
239243
'**/__tests__/**',
240-
'e2e/**',
241-
'**/pretty-format/perf/**',
244+
'packages/jest-types/**/*',
245+
'.eslintplugin/**',
242246
],
243247
rules: {
244248
'import/no-extraneous-dependencies': 'off',
@@ -254,11 +258,12 @@ module.exports = {
254258
},
255259
{
256260
env: {node: true},
257-
files: ['*.js', '*.jsx'],
261+
files: ['*.js', '*.jsx', '*.mjs', '*.cjs'],
258262
},
259263
{
260264
files: [
261265
'scripts/*',
266+
'packages/*/__benchmarks__/test.js',
262267
'packages/jest-cli/src/init/index.ts',
263268
'packages/jest-repl/src/cli/runtime-cli.ts',
264269
],
@@ -270,14 +275,10 @@ module.exports = {
270275
files: [
271276
'e2e/**',
272277
'examples/**',
273-
'scripts/*',
274278
'website/**',
275279
'**/__mocks__/**',
276280
'**/__tests__/**',
277281
'**/__typetests__/**',
278-
'**/__performance_tests__/**',
279-
'packages/diff-sequences/perf/index.js',
280-
'packages/pretty-format/perf/test.js',
281282
],
282283
rules: {
283284
'@typescript-eslint/no-unused-vars': 'off',
@@ -325,7 +326,7 @@ module.exports = {
325326
'scripts/**',
326327
'babel.config.js',
327328
'testSetupFile.js',
328-
'.eslintrc.js',
329+
'.eslintrc.cjs',
329330
],
330331
},
331332
],
@@ -365,7 +366,6 @@ module.exports = {
365366
'no-bitwise': 'warn',
366367
'no-caller': 'error',
367368
'no-case-declarations': 'off',
368-
'no-catch-shadow': 'error',
369369
'no-class-assign': 'warn',
370370
'no-cond-assign': 'off',
371371
'no-confusing-arrow': 'off',
@@ -467,7 +467,7 @@ module.exports = {
467467
'no-unused-expressions': 'off',
468468
'no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
469469
'no-use-before-define': 'off',
470-
'no-useless-call': 'warn',
470+
'no-useless-call': 'error',
471471
'no-useless-computed-key': 'error',
472472
'no-useless-concat': 'error',
473473
'no-var': 'error',
@@ -507,7 +507,9 @@ module.exports = {
507507
'import/ignore': ['react-native'],
508508
// using `new RegExp` makes sure to escape `/`
509509
'import/internal-regex': new RegExp(
510-
internalPackages.map(pkg => `^${pkg}$`).join('|'),
510+
getPackages()
511+
.map(pkg => `^${pkg}$`)
512+
.join('|'),
511513
).source,
512514
'import/resolver': {
513515
typescript: {},

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text=auto
1+
* text=auto eol=lf

.github/workflows/close-stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: 'Close month old issues and PRs'
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/stale@v4
11+
- uses: actions/stale@v5
1212
with:
1313
start-date: '2022-01-01T00:00:00Z'
1414
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.'
@@ -27,7 +27,7 @@ jobs:
2727
name: 'Close year old issues and PRs'
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/stale@v4
30+
- uses: actions/stale@v5
3131
with:
3232
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.'
3333
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.'

.github/workflows/nodejs.yml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
YARN_ENABLE_SCRIPTS: false
3939
run: yarn --immutable
4040

41-
lint-and-typecheck:
42-
name: Running TypeScript compiler & ESLint
41+
typecheck:
42+
name: Running TypeScript compiler
4343
runs-on: ubuntu-latest
4444
needs: prepare-yarn-cache
4545

@@ -55,8 +55,24 @@ jobs:
5555
run: yarn build
5656
- name: test typings
5757
run: yarn test-types
58-
- name: verify TypeScript@4.2 compatibility
58+
- name: verify TypeScript@4.3 compatibility
5959
run: yarn verify-old-ts
60+
61+
lint:
62+
name: Running Lint
63+
runs-on: ubuntu-latest
64+
needs: prepare-yarn-cache
65+
66+
steps:
67+
- uses: actions/checkout@v3
68+
- uses: actions/setup-node@v3
69+
with:
70+
node-version: lts/*
71+
cache: yarn
72+
- name: install
73+
run: yarn --immutable
74+
- name: build
75+
run: yarn build:js
6076
- name: verify Yarn PnP compatibility
6177
run: yarn verify-pnp
6278
- name: run eslint
@@ -66,12 +82,27 @@ jobs:
6682
- name: check copyright headers
6783
run: yarn check-copyright-headers
6884

85+
yarn-validate:
86+
name: Validate Yarn dependencies and constraints
87+
runs-on: ubuntu-latest
88+
needs: prepare-yarn-cache
89+
steps:
90+
- uses: actions/checkout@v3
91+
- uses: actions/setup-node@v3
92+
with:
93+
node-version: lts/*
94+
cache: yarn
95+
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
96+
run: yarn constraints
97+
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
98+
run: yarn dedupe --check
99+
69100
test:
70101
name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (${{ matrix.shard }})
71102
strategy:
72103
fail-fast: false
73104
matrix:
74-
node-version: [12.x, 14.x, 16.x, 17.x]
105+
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]
75106
os: [ubuntu-latest, macOS-latest, windows-latest]
76107
shard: ['1/4', '2/4', '3/4', '4/4']
77108
runs-on: ${{ matrix.os }}
@@ -80,9 +111,7 @@ jobs:
80111
steps:
81112
- name: Set git config
82113
shell: bash
83-
run: |
84-
git config --global core.autocrlf false
85-
git config --global core.symlinks true
114+
run: git config --global core.symlinks true
86115
if: runner.os == 'Windows'
87116
- uses: actions/checkout@v3
88117
- name: Use Node.js ${{ matrix.node-version }}
@@ -113,9 +142,7 @@ jobs:
113142
steps:
114143
- name: Set git config
115144
shell: bash
116-
run: |
117-
git config --global core.autocrlf false
118-
git config --global core.symlinks true
145+
run: git config --global core.symlinks true
119146
if: runner.os == 'Windows'
120147
- uses: actions/checkout@v3
121148
- name: Use Node.js LTS
@@ -158,12 +185,12 @@ jobs:
158185
uses: SimenB/github-actions-cpu-cores@v1
159186
- name: run tests with coverage
160187
run: |
161-
yarn jest-coverage --color --config jest.config.ci.js --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
188+
yarn jest-coverage --color --config jest.config.ci.mjs --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
162189
yarn test-leak
163190
- name: map coverage
164-
run: node ./scripts/mapCoverage.js
191+
run: node ./scripts/mapCoverage.mjs
165192
if: always()
166-
- uses: codecov/codecov-action@v2
193+
- uses: codecov/codecov-action@v3
167194
if: always()
168195
with:
169196
directory: ./coverage

.prettierignore

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1-
fixtures/failing-jsons/
1+
.idea
2+
.DS_STORE
3+
.eslintcache
4+
*.swp
5+
*~
6+
api-extractor.json
7+
coverage
8+
9+
/packages/*/build
10+
/packages/*/dist
11+
/packages/jest-config/src/__tests__/jest-preset.json
12+
/packages/pretty-format/__benchmarks__/world.geo.json
13+
14+
# Breaks tests
15+
/e2e/coverage-handlebars/greet.hbs
16+
17+
# Third-party script
218
packages/jest-diff/src/cleanupSemantic.ts
3-
packages/jest-config/src/__tests__/jest-preset.json
4-
packages/pretty-format/perf/world.geo.json
5-
website/versions.json
19+
20+
/website/.docusaurus
21+
/website/backers.json
22+
/website/build
23+
/website/versions.json
24+
25+
**/.yarn
26+
**/.pnp.*

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"editor.rulers": [80],
33
"files.exclude": {
4-
"**/.git": true,
4+
"**/.git": true
55
},
66
"javascript.validate.enable": false,
77
"jest.pathToJest": "yarn jest --",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/jest/setup.js b/jest/setup.js
2+
index 5bc65447594091c2da6dadb4be6bc1c6da43c7a0..356e7ff3eb55947e084db5d1df9b2d9f0544a15b 100644
3+
--- a/jest/setup.js
4+
+++ b/jest/setup.js
5+
@@ -17,13 +17,8 @@ jest.requireActual('@react-native/polyfills/error-guard');
6+
7+
global.__DEV__ = true;
8+
9+
-global.performance = {
10+
- now: jest.fn(Date.now),
11+
-};
12+
-
13+
global.Promise = jest.requireActual('promise');
14+
global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime');
15+
-global.window = global;
16+
17+
global.requestAnimationFrame = function (callback) {
18+
return setTimeout(callback, 0);

.yarn/plugins/@yarnpkg/plugin-constraints.cjs

Lines changed: 52 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)