Skip to content

Commit 28e1b1e

Browse files
committed
Merge branch 'main' into patch
2 parents b57de1f + acc803a commit 28e1b1e

File tree

593 files changed

+15447
-16022
lines changed

Some content is hidden

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

593 files changed

+15447
-16022
lines changed

.circleci/config.yml

+2-3
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].1
1616

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

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ website/static
1212

1313
# Third-party script
1414
packages/jest-diff/src/cleanupSemantic.ts
15+
e2e/native-esm/wasm-bindgen/index_bg.js
1516

1617
**/.yarn
1718
**/.pnp.*

.eslintrc.cjs

+126-32
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,39 @@ module.exports = {
3333
'plugin:markdown/recommended',
3434
'plugin:import/errors',
3535
'plugin:eslint-comments/recommended',
36+
'plugin:unicorn/recommended',
37+
'plugin:promise/recommended',
3638
'plugin:prettier/recommended',
3739
],
3840
globals: {
3941
console: 'readonly',
4042
},
4143
overrides: [
4244
{
43-
extends: ['plugin:@typescript-eslint/strict', 'plugin:import/typescript'],
45+
extends: [
46+
'plugin:@typescript-eslint/eslint-recommended',
47+
'plugin:@typescript-eslint/strict',
48+
'plugin:@typescript-eslint/stylistic',
49+
'plugin:import/typescript',
50+
],
4451
files: ['*.ts', '*.tsx'],
4552
plugins: ['@typescript-eslint/eslint-plugin', 'local'],
4653
rules: {
4754
'@typescript-eslint/array-type': ['error', {default: 'generic'}],
4855
'@typescript-eslint/ban-types': 'error',
56+
'@typescript-eslint/consistent-type-imports': [
57+
'error',
58+
{fixStyle: 'inline-type-imports', disallowTypeAnnotations: false},
59+
],
60+
'@typescript-eslint/no-import-type-side-effects': 'error',
4961
'@typescript-eslint/no-inferrable-types': 'error',
5062
'@typescript-eslint/no-unused-vars': [
5163
'error',
5264
{argsIgnorePattern: '^_'},
5365
],
5466
'@typescript-eslint/prefer-ts-expect-error': 'error',
5567
'@typescript-eslint/no-var-requires': 'off',
68+
'@typescript-eslint/consistent-indexed-object-style': 'off',
5669
// TS verifies these
5770
'consistent-return': 'off',
5871
'no-dupe-class-members': 'off',
@@ -62,24 +75,14 @@ module.exports = {
6275
'@typescript-eslint/no-explicit-any': 'off',
6376
'@typescript-eslint/no-non-null-assertion': 'off',
6477
'@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',
78+
'@typescript-eslint/consistent-type-definitions': 'off',
6979

7080
// not needed to be enforced for TS
7181
'import/namespace': 'off',
7282
},
7383
},
7484
{
7585
files: [
76-
'packages/jest-jasmine2/src/jasmine/Env.ts',
77-
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
78-
'packages/jest-jasmine2/src/jasmine/Spec.ts',
79-
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
80-
'packages/jest-jasmine2/src/jasmine/Suite.ts',
81-
'packages/jest-jasmine2/src/jasmine/createSpy.ts',
82-
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
8386
'packages/jest-mock/src/__tests__/index.test.ts',
8487
'packages/jest-mock/src/index.ts',
8588
'packages/pretty-format/src/__tests__/Immutable.test.ts',
@@ -94,13 +97,7 @@ module.exports = {
9497
files: [
9598
'packages/expect/src/index.ts',
9699
'packages/jest-fake-timers/src/legacyFakeTimers.ts',
97-
'packages/jest-jasmine2/src/jasmine/Env.ts',
98-
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
99-
'packages/jest-jasmine2/src/jasmine/Spec.ts',
100-
'packages/jest-jasmine2/src/jasmine/Suite.ts',
101-
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
102100
'packages/jest-jasmine2/src/jestExpect.ts',
103-
'packages/jest-resolve/src/resolver.ts',
104101
],
105102
rules: {
106103
'local/prefer-spread-eventually': 'warn',
@@ -117,8 +114,6 @@ module.exports = {
117114
'packages/expect-utils/src/utils.ts',
118115
'packages/jest-core/src/collectHandles.ts',
119116
'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts',
120-
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
121-
'packages/jest-jasmine2/src/jasmine/Suite.ts',
122117
'packages/jest-leak-detector/src/index.ts',
123118
'packages/jest-matcher-utils/src/index.ts',
124119
'packages/jest-mock/src/__tests__/index.test.ts',
@@ -151,6 +146,13 @@ module.exports = {
151146
],
152147
},
153148
},
149+
{
150+
files: 'e2e/coverage-remapping/covered.ts',
151+
rules: {
152+
'no-constant-binary-expression': 'off',
153+
'no-constant-condition': 'off',
154+
},
155+
},
154156

155157
// 'eslint-plugin-jest' rules for test and test related files
156158
{
@@ -213,9 +215,15 @@ module.exports = {
213215
'jest/no-focused-tests': 'off',
214216
'jest/require-to-throw-message': 'off',
215217
'no-console': 'off',
218+
'no-constant-condition': 'off',
216219
'no-undef': 'off',
217220
'no-unused-vars': 'off',
218221
'sort-keys': 'off',
222+
'unicorn/consistent-function-scoping': 'off',
223+
'unicorn/error-message': 'off',
224+
'unicorn/no-await-expression-member': 'off',
225+
'unicorn/no-static-only-class': 'off',
226+
'unicorn/prefer-number-properties': 'off',
219227
},
220228
},
221229
// demonstration of matchers usage
@@ -278,6 +286,16 @@ module.exports = {
278286
'no-restricted-imports': 'off',
279287
},
280288
},
289+
{
290+
files: ['examples/angular/**/*'],
291+
rules: {
292+
// Angular DI for some reason doesn't work with type imports
293+
'@typescript-eslint/consistent-type-imports': [
294+
'error',
295+
{prefer: 'no-type-imports', disallowTypeAnnotations: false},
296+
],
297+
},
298+
},
281299
{
282300
files: 'packages/**/*.ts',
283301
rules: {
@@ -301,6 +319,7 @@ module.exports = {
301319
rules: {
302320
'@typescript-eslint/ban-ts-comment': 'off',
303321
'@typescript-eslint/no-empty-function': 'off',
322+
'@typescript-eslint/class-literal-property-style': 'off',
304323
},
305324
},
306325
{
@@ -313,6 +332,9 @@ module.exports = {
313332
],
314333
rules: {
315334
'@typescript-eslint/explicit-module-boundary-types': 'off',
335+
'unicorn/consistent-function-scoping': 'off',
336+
'unicorn/no-await-expression-member': 'off',
337+
'unicorn/prefer-spread': 'off',
316338
},
317339
},
318340
{
@@ -321,8 +343,12 @@ module.exports = {
321343
'packages/expect-utils/src/jasmineUtils.ts',
322344
],
323345
rules: {
346+
'@typescript-eslint/ban-types': 'off',
324347
'eslint-comments/disable-enable-pair': 'off',
325348
'eslint-comments/no-unlimited-disable': 'off',
349+
'prefer-rest-params': 'off',
350+
'prefer-spread': 'off',
351+
'sort-keys ': 'off',
326352
},
327353
},
328354
{
@@ -342,11 +368,13 @@ module.exports = {
342368
'website/**',
343369
'**/__benchmarks__/**',
344370
'**/__tests__/**',
345-
'packages/jest-types/**/*',
371+
'**/__typetests__/**',
346372
'.eslintplugin/**',
347373
],
348374
rules: {
349375
'import/no-extraneous-dependencies': 'off',
376+
'unicorn/consistent-function-scoping': 'off',
377+
'unicorn/error-message': 'off',
350378
},
351379
},
352380
{
@@ -389,12 +417,43 @@ module.exports = {
389417
'no-unused-vars': 'off',
390418
},
391419
},
420+
{
421+
files: 'packages/jest-mock/src/__tests__/**/*',
422+
rules: {
423+
'unicorn/no-static-only-class': 'off',
424+
},
425+
},
426+
{
427+
files: '**/*.mjs',
428+
rules: {
429+
'unicorn/prefer-top-level-await': 'error',
430+
},
431+
},
432+
{
433+
files: [
434+
'e2e/coverage-report/__mocks__/sumDependency.js',
435+
'e2e/require-main-after-create-require/empty.js',
436+
'packages/create-jest/src/__tests__/__fixtures__/**/*',
437+
'packages/jest-core/src/__tests__/**/*',
438+
'packages/jest-haste-map/src/__tests__/test_dotfiles_root/**/*',
439+
'packages/jest-resolve/src/__mocks__/**/*',
440+
],
441+
rules: {
442+
'unicorn/no-empty-file': 'off',
443+
},
444+
},
445+
{
446+
files: 'packages/expect/src/__tests__/*.test.js',
447+
rules: {
448+
'unicorn/prefer-number-properties': 'off',
449+
},
450+
},
392451
],
393452
parser: '@typescript-eslint/parser',
394453
parserOptions: {
395454
sourceType: 'module',
396455
},
397-
plugins: ['import', 'jsdoc', 'unicorn'],
456+
plugins: ['import', 'jsdoc'],
398457
rules: {
399458
'accessor-pairs': ['warn', {setWithoutGet: true}],
400459
'block-scoped-var': 'off',
@@ -416,6 +475,7 @@ module.exports = {
416475
'handle-callback-err': 'off',
417476
'id-length': 'off',
418477
'id-match': 'off',
478+
'import/no-duplicates': 'error',
419479
'import/no-extraneous-dependencies': [
420480
'error',
421481
{
@@ -473,7 +533,8 @@ module.exports = {
473533
{allow: ['warn', 'error', 'time', 'timeEnd', 'timeStamp']},
474534
],
475535
'no-const-assign': 'error',
476-
'no-constant-condition': 'off',
536+
'no-constant-condition': 'error',
537+
'no-constant-binary-expression': 'error',
477538
'no-continue': 'off',
478539
'no-control-regex': 'off',
479540
'no-debugger': 'error',
@@ -515,9 +576,7 @@ module.exports = {
515576
'no-multi-str': 'error',
516577
'no-multiple-empty-lines': 'off',
517578
'no-native-reassign': ['error', {exceptions: ['Map', 'Set']}],
518-
'no-negated-condition': 'off',
519579
'no-negated-in-lhs': 'error',
520-
'no-nested-ternary': 'off',
521580
'no-new': 'warn',
522581
'no-new-func': 'error',
523582
'no-new-object': 'warn',
@@ -579,6 +638,11 @@ module.exports = {
579638
'prefer-arrow-callback': ['error', {allowNamedFunctions: true}],
580639
'prefer-const': 'error',
581640
'prefer-template': 'error',
641+
642+
'promise/always-return': 'off',
643+
'promise/catch-or-return': 'off',
644+
'promise/no-callback-in-promise': 'off',
645+
582646
quotes: [
583647
'error',
584648
'single',
@@ -600,13 +664,43 @@ module.exports = {
600664
'wrap-regex': 'off',
601665
yoda: 'off',
602666

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',
667+
// doesn't work without ESModuleInterop
668+
'unicorn/import-style': 'off',
669+
// we're a CJS project
670+
'unicorn/prefer-module': 'off',
671+
672+
// enforced by `@typescript-eslint/no-this-alias` already
673+
'unicorn/no-this-assignment': 'off',
674+
675+
// Not an issue with TypeScript
676+
'unicorn/no-array-callback-reference': 'off',
677+
678+
// reduce is fine
679+
'unicorn/no-array-reduce': 'off',
680+
681+
// this is very aggressive (600+ files changed). might make sense to apply bit by bit over time?
682+
'unicorn/prevent-abbreviations': 'off',
683+
684+
// nah
685+
'unicorn/consistent-destructuring': 'off',
686+
'unicorn/no-lonely-if': 'off',
687+
'unicorn/no-null': 'off',
688+
'unicorn/no-process-exit': 'off',
689+
'unicorn/no-useless-undefined': 'off',
690+
'unicorn/prefer-event-target': 'off',
691+
'unicorn/prefer-switch': 'off',
692+
'unicorn/prefer-ternary': 'off',
693+
'unicorn/prefer-top-level-await': 'off',
694+
'unicorn/switch-case-braces': 'off',
695+
696+
// TODO: decide whether or not we want these
697+
'unicorn/filename-case': 'off',
698+
'unicorn/prefer-reflect-apply': 'off',
699+
700+
// enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780
701+
'unicorn/prefer-export-from': 'off',
702+
// enabling this is blocked by https://github.com/jestjs/jest/pull/14297
703+
'unicorn/prefer-node-protocol': 'off',
610704
},
611705
settings: {
612706
'import/ignore': ['react-native'],

.github/renovate.json

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
{
1313
"matchPackageNames": ["jest-runner-tsd", "tsd-lite"],
1414
"groupName": "tsd"
15+
},
16+
{
17+
"matchPackageNames": ["@lerna-lite/cli", "@lerna-lite/publish"],
18+
"groupName": "lerna-lite"
1519
}
1620
]
1721
}

.github/workflows/close-stale.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: 'Close month old issues and PRs'
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/stale@v8
15+
- uses: actions/stale@v9
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.'
@@ -32,7 +32,7 @@ jobs:
3232
name: 'Close year old issues and PRs'
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/stale@v8
35+
- uses: actions/stale@v9
3636
with:
3737
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.'
3838
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/lock.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ on:
44
schedule:
55
- cron: '0 0 * * *'
66

7+
concurrency:
8+
group: lock-threads
9+
710
permissions: {}
811
jobs:
912
lock:
1013
permissions:
1114
issues: write # to lock issues (dessant/lock-threads)
1215
pull-requests: write # to lock PRs (dessant/lock-threads)
16+
discussions: write # to lock discussions (dessant/lock-threads)
1317

1418
runs-on: ubuntu-latest
1519
steps:
16-
- uses: dessant/lock-threads@v4
20+
- uses: dessant/lock-threads@v5
1721
with:
1822
github-token: ${{ github.token }}
23+
process-only: 'issues, prs'
1924
issue-inactive-days: '30'
2025
exclude-any-issue-labels: 'Discussion'
2126
issue-comment: >

0 commit comments

Comments
 (0)