Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
michalwarda committed Apr 26, 2022
2 parents 159c4f8 + b55add9 commit 0ac1eee
Show file tree
Hide file tree
Showing 641 changed files with 10,531 additions and 35,693 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -54,5 +54,5 @@ workflows:
name: test-node-partial-<< matrix.node-version >>
matrix:
parameters:
node-version: ['12', '14', '16', '17']
node-version: ['12', '14', '16', '17', '18']
- test-jest-jasmine
11 changes: 8 additions & 3 deletions .eslintignore
@@ -1,14 +1,19 @@
!.*
**/coverage/**
**/node_modules/**
bin/
flow-typed/**
packages/*/build/**
packages/*/dist/**
packages/jest-diff/src/cleanupSemantic.ts
website/.docusaurus
website/blog
website/build
website/node_modules
website/i18n/*.js
website/static
!.eslintrc.js

# Third-party script
packages/jest-diff/src/cleanupSemantic.ts

**/.yarn
**/.pnp.*

48 changes: 25 additions & 23 deletions .eslintrc.js → .eslintrc.cjs
Expand Up @@ -5,11 +5,21 @@
* LICENSE file in the root directory of this source tree.
*/

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

const internalPackages = getPackages()
.map(({pkg}) => pkg.name)
.sort();
function getPackages() {
const PACKAGES_DIR = path.resolve(__dirname, 'packages');
const packages = fs
.readdirSync(PACKAGES_DIR)
.map(file => path.resolve(PACKAGES_DIR, file))
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory());
return packages.map(packageDir => {
const pkg = readPkg({cwd: packageDir});
return pkg.name;
});
}

module.exports = {
env: {
Expand Down Expand Up @@ -91,8 +101,6 @@ module.exports = {
'packages/expect/src/print.ts',
'packages/expect/src/toThrowMatchers.ts',
'packages/expect-utils/src/utils.ts',
'packages/jest-core/src/ReporterDispatcher.ts',
'packages/jest-core/src/TestScheduler.ts',
'packages/jest-core/src/collectHandles.ts',
'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts',
'packages/jest-haste-map/src/index.ts',
Expand Down Expand Up @@ -176,12 +184,6 @@ module.exports = {
'import/order': 'off',
},
},
{
files: 'packages/jest-types/**/*',
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
{
files: 'packages/**/*.ts',
rules: {
Expand Down Expand Up @@ -235,10 +237,12 @@ module.exports = {
},
{
files: [
'e2e/**',
'website/**',
'**/__benchmarks__/**',
'**/__tests__/**',
'e2e/**',
'**/pretty-format/perf/**',
'packages/jest-types/**/*',
'.eslintplugin/**',
],
rules: {
'import/no-extraneous-dependencies': 'off',
Expand All @@ -254,11 +258,12 @@ module.exports = {
},
{
env: {node: true},
files: ['*.js', '*.jsx'],
files: ['*.js', '*.jsx', '*.mjs', '*.cjs'],
},
{
files: [
'scripts/*',
'packages/*/__benchmarks__/test.js',
'packages/jest-cli/src/init/index.ts',
'packages/jest-repl/src/cli/runtime-cli.ts',
],
Expand All @@ -270,14 +275,10 @@ module.exports = {
files: [
'e2e/**',
'examples/**',
'scripts/*',
'website/**',
'**/__mocks__/**',
'**/__tests__/**',
'**/__typetests__/**',
'**/__performance_tests__/**',
'packages/diff-sequences/perf/index.js',
'packages/pretty-format/perf/test.js',
],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
Expand Down Expand Up @@ -325,7 +326,7 @@ module.exports = {
'scripts/**',
'babel.config.js',
'testSetupFile.js',
'.eslintrc.js',
'.eslintrc.cjs',
],
},
],
Expand Down Expand Up @@ -365,7 +366,6 @@ module.exports = {
'no-bitwise': 'warn',
'no-caller': 'error',
'no-case-declarations': 'off',
'no-catch-shadow': 'error',
'no-class-assign': 'warn',
'no-cond-assign': 'off',
'no-confusing-arrow': 'off',
Expand Down Expand Up @@ -467,7 +467,7 @@ module.exports = {
'no-unused-expressions': 'off',
'no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'no-use-before-define': 'off',
'no-useless-call': 'warn',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-var': 'error',
Expand Down Expand Up @@ -507,7 +507,9 @@ module.exports = {
'import/ignore': ['react-native'],
// using `new RegExp` makes sure to escape `/`
'import/internal-regex': new RegExp(
internalPackages.map(pkg => `^${pkg}$`).join('|'),
getPackages()
.map(pkg => `^${pkg}$`)
.join('|'),
).source,
'import/resolver': {
typescript: {},
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1 +1 @@
* text=auto
* text=auto eol=lf
4 changes: 2 additions & 2 deletions .github/workflows/close-stale.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
name: 'Close month old issues and PRs'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
- uses: actions/stale@v5
with:
start-date: '2022-01-01T00:00:00Z'
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.'
Expand All @@ -27,7 +27,7 @@ jobs:
name: 'Close year old issues and PRs'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
- uses: actions/stale@v5
with:
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.'
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.'
Expand Down
53 changes: 40 additions & 13 deletions .github/workflows/nodejs.yml
Expand Up @@ -38,8 +38,8 @@ jobs:
YARN_ENABLE_SCRIPTS: false
run: yarn --immutable

lint-and-typecheck:
name: Running TypeScript compiler & ESLint
typecheck:
name: Running TypeScript compiler
runs-on: ubuntu-latest
needs: prepare-yarn-cache

Expand All @@ -55,8 +55,24 @@ jobs:
run: yarn build
- name: test typings
run: yarn test-types
- name: verify TypeScript@4.2 compatibility
- name: verify TypeScript@4.3 compatibility
run: yarn verify-old-ts

lint:
name: Running Lint
runs-on: ubuntu-latest
needs: prepare-yarn-cache

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: install
run: yarn --immutable
- name: build
run: yarn build:js
- name: verify Yarn PnP compatibility
run: yarn verify-pnp
- name: run eslint
Expand All @@ -66,12 +82,27 @@ jobs:
- name: check copyright headers
run: yarn check-copyright-headers

yarn-validate:
name: Validate Yarn dependencies and constraints
runs-on: ubuntu-latest
needs: prepare-yarn-cache
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
run: yarn constraints
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
run: yarn dedupe --check

test:
name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (${{ matrix.shard }})
strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
shard: ['1/4', '2/4', '3/4', '4/4']
runs-on: ${{ matrix.os }}
Expand All @@ -80,9 +111,7 @@ jobs:
steps:
- name: Set git config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
run: git config --global core.symlinks true
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -113,9 +142,7 @@ jobs:
steps:
- name: Set git config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
run: git config --global core.symlinks true
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- name: Use Node.js LTS
Expand Down Expand Up @@ -158,12 +185,12 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v1
- name: run tests with coverage
run: |
yarn jest-coverage --color --config jest.config.ci.js --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
yarn jest-coverage --color --config jest.config.ci.mjs --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
yarn test-leak
- name: map coverage
run: node ./scripts/mapCoverage.js
run: node ./scripts/mapCoverage.mjs
if: always()
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
if: always()
with:
directory: ./coverage
29 changes: 25 additions & 4 deletions .prettierignore
@@ -1,5 +1,26 @@
fixtures/failing-jsons/
.idea
.DS_STORE
.eslintcache
*.swp
*~
api-extractor.json
coverage

/packages/*/build
/packages/*/dist
/packages/jest-config/src/__tests__/jest-preset.json
/packages/pretty-format/__benchmarks__/world.geo.json

# Breaks tests
/e2e/coverage-handlebars/greet.hbs

# Third-party script
packages/jest-diff/src/cleanupSemantic.ts
packages/jest-config/src/__tests__/jest-preset.json
packages/pretty-format/perf/world.geo.json
website/versions.json

/website/.docusaurus
/website/backers.json
/website/build
/website/versions.json

**/.yarn
**/.pnp.*
2 changes: 1 addition & 1 deletion .vscode/settings.json
@@ -1,7 +1,7 @@
{
"editor.rulers": [80],
"files.exclude": {
"**/.git": true,
"**/.git": true
},
"javascript.validate.enable": false,
"jest.pathToJest": "yarn jest --",
Expand Down
18 changes: 18 additions & 0 deletions .yarn/patches/react-native-npm-0.68.1-8830b7be0d.patch
@@ -0,0 +1,18 @@
diff --git a/jest/setup.js b/jest/setup.js
index 5bc65447594091c2da6dadb4be6bc1c6da43c7a0..356e7ff3eb55947e084db5d1df9b2d9f0544a15b 100644
--- a/jest/setup.js
+++ b/jest/setup.js
@@ -17,13 +17,8 @@ jest.requireActual('@react-native/polyfills/error-guard');

global.__DEV__ = true;

-global.performance = {
- now: jest.fn(Date.now),
-};
-
global.Promise = jest.requireActual('promise');
global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime');
-global.window = global;

global.requestAnimationFrame = function (callback) {
return setTimeout(callback, 0);
52 changes: 52 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Expand Up @@ -22,6 +22,8 @@ packageExtensions:
"@babel/preset-env": ^7.1.6

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
Expand Down

0 comments on commit 0ac1eee

Please sign in to comment.