Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade jest #33277

Merged
merged 35 commits into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f8f881b
chore: upgrade jest
wardpeet Sep 21, 2021
8cb5228
update jest
wardpeet Sep 21, 2021
d2064c8
update babel-jest
wardpeet Sep 22, 2021
f1c48c4
fix typings
wardpeet Sep 22, 2021
2e06143
merge master
LekoArts Oct 25, 2021
6257429
ts check
LekoArts Oct 25, 2021
be6bd37
fix tests?
LekoArts Oct 25, 2021
17cc050
fix setImmediate
LekoArts Oct 25, 2021
74f4504
some more fixes
LekoArts Oct 25, 2021
9c620b1
more
LekoArts Oct 25, 2021
9c7153d
moar
LekoArts Oct 25, 2021
cdc38df
update snapshot serializer
LekoArts Oct 29, 2021
3e79b38
cleanup
LekoArts Oct 29, 2021
9ae3e0d
merge master
LekoArts Dec 9, 2021
eb3cd19
snapshot merging is the worst
LekoArts Dec 9, 2021
738e87e
merge master. again
LekoArts Dec 9, 2021
45d4154
Merge remote-tracking branch 'upstream/master' into chore/upgrade-jest
Dec 10, 2021
109fc81
lock file cleanup
LekoArts Dec 10, 2021
436f81e
lock :shrug:
LekoArts Dec 10, 2021
0afb944
gc-cloud thingy works a bit
LekoArts Dec 10, 2021
212a911
remote-file-node
LekoArts Dec 10, 2021
30ca84f
update snapshot
LekoArts Dec 14, 2021
3fa47be
jobsv2
LekoArts Dec 14, 2021
bbce756
jobs-manager
LekoArts Dec 14, 2021
d5763e0
gatsby-plugin-image
LekoArts Dec 14, 2021
d02cb94
snapshot update
LekoArts Dec 14, 2021
0cab490
Merge branch 'master' into chore/upgrade-jest
LekoArts Dec 14, 2021
fe0cffd
fix openhandle
wardpeet Dec 14, 2021
a4ab412
ignore eperm errors in test
wardpeet Dec 14, 2021
4b3af7d
fix exit 1?
wardpeet Dec 14, 2021
381a544
fix integration tests
wardpeet Dec 14, 2021
ac582d9
fix broken urling
wardpeet Dec 15, 2021
fdad3c9
Merge branch 'master' into chore/upgrade-jest
wardpeet Dec 17, 2021
2ebad97
fix cloud plugin tests
wardpeet Dec 17, 2021
4d3d48a
fix sharding test
wardpeet Dec 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/high-priority-prs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"lodash": "^4.17.15"
},
"devDependencies": {
"jest": "^25.1.0"
"jest": "^27.2.1"
}
}
3 changes: 3 additions & 0 deletions .jestSetup.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
process.env.GATSBY_RECIPES_NO_COLOR = "true"

// Potrace has a dependency on giwrap which has a process.nextTick as a sideEffect which messes up with jest.
jest.mock(`gifwrap`, () => jest.fn())
2 changes: 1 addition & 1 deletion deprecated-packages/gatsby-recipes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"hicat": "^0.8.0",
"is-binary-path": "^2.1.0",
"is-url": "^1.2.4",
"jest-diff": "^25.5.0",
"jest-diff": "^27.2.0",
"lock": "^1.0.0",
"lodash": "^4.17.21",
"mitt": "^1.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import diff from "jest-diff"
import { diff } from "jest-diff"
import chalk from "chalk"
import stripAnsi from "strip-ansi"

Expand Down
4 changes: 2 additions & 2 deletions examples/using-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"babel-jest": "^24.9.0",
"babel-preset-gatsby": "^0.5.10",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.9.0"
"jest": "^27.2.1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby"
}
}
}
2 changes: 1 addition & 1 deletion integration-tests/artifacts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"devDependencies": {
"fs-extra": "^9.0.0",
"jest": "^24.0.0"
"jest": "^27.2.1"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cache-resilience/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"fs-extra": "^9.0.1",
"gatsby-core-utils": "^3.0.0-next.0",
"glob": "^7.1.6",
"jest": "^24.0.0",
"jest": "^27.2.1",
"jest-serializer-path": "^0.1.15",
"lodash": "^4.17.20",
"slash": "^3.0.0",
Expand Down
7 changes: 4 additions & 3 deletions integration-tests/functions/jest-transformer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const babelPreset = require(`babel-preset-gatsby-package`)()
module.exports = require(`babel-jest`).createTransformer({
...babelPreset,
const babelJest = require(`babel-jest`)

module.exports = babelJest.default.createTransformer({
presets: [`babel-preset-gatsby-package`],
})
14 changes: 8 additions & 6 deletions integration-tests/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"private": true,
"description": "functions",
"author": "Kyle Mathews",
"keywords": ["gatsby"],
"keywords": [
"gatsby"
],
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
Expand All @@ -17,16 +19,16 @@
"test": "npm-run-all -s build test-prod test-dev"
},
"devDependencies": {
"babel-jest": "^24.0.0",
"babel-preset-gatsby-package": "^1.3.0",
"fs-extra": "^9.0.0",
"jest": "^24.0.0",
"babel-jest": "^27.4.5",
"babel-preset-gatsby-package": "^2.4.0",
"fs-extra": "^10.0.0",
"jest": "^27.2.1",
"npm-run-all": "4.1.5",
"start-server-and-test": "^1.11.3"
},
"dependencies": {
"gatsby": "next",
"gatsby-plugin-gatsby-cloud": "^2.5.0-next.0",
"gatsby-plugin-gatsby-cloud": "next",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
Expand Down
7 changes: 4 additions & 3 deletions integration-tests/gatsby-cli/jest-transformer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const babelPreset = require(`babel-preset-gatsby-package`)()
module.exports = require(`babel-jest`).createTransformer({
...babelPreset,
const babelJest = require(`babel-jest`)

module.exports = babelJest.default.createTransformer({
presets: [`babel-preset-gatsby-package`],
})
16 changes: 8 additions & 8 deletions integration-tests/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
},
"license": "MIT",
"scripts": {
"test": "jest -w 1"
"test": "jest --runInBand"
},
"devDependencies": {
"babel-jest": "^24.0.0",
"babel-preset-gatsby-package": "^1.3.0",
"babel-jest": "^27.2.1",
"babel-preset-gatsby-package": "next",
"del-cli": "^3.0.1",
"execa": "^4.0.1",
"fs-extra": "^9.0.0",
"gatsby": "^3.3.0",
"gatsby-cli": "^3.3.0",
"gatsby-core-utils": "^2.3.0",
"jest": "^24.0.0",
"gatsby": "next",
"gatsby-cli": "next",
"gatsby-core-utils": "next",
"jest": "^27.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
}
}
}
2 changes: 1 addition & 1 deletion integration-tests/gatsby-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"fs-extra": "^9.0.1",
"md5-file": "^5.0.0",
"node-fetch": "^2.6.0",
"jest": "^25.5.4",
"jest": "^27.2.1",
"tree-kill": "^1.2.2"
},
"repository": {
Expand Down
28 changes: 18 additions & 10 deletions integration-tests/gatsby-source-wordpress/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ const isWarmCache = process.env.WARM_CACHE
const testOnColdCacheOnly = isWarmCache ? test.skip : test

describe(`[gatsby-source-wordpress] Build default options`, () => {
beforeAll(async done => {
await urling({ url: `http://localhost:8001/graphql`, retry: 100 })
beforeAll(done => {
;(async () => {
await urling({ url: `http://localhost:8001/graphql`, retry: 100 })

if (isWarmCache) {
done()
} else {
gatsbyCleanBeforeAll(done)
}
if (isWarmCache) {
done()
} else {
gatsbyCleanBeforeAll(done)
}
})()
})

testOnColdCacheOnly(`Default options build succeeded`, async () => {
Expand Down Expand Up @@ -89,9 +91,15 @@ describe(`[gatsby-source-wordpress] Run tests on develop build`, () => {
process.exit(1)
}

gatsbyDevelopProcess = spawnGatsbyProcess(`develop`)

await urling(`http://localhost:8000`, { retry: 100 })
return new Promise(resolve => {
gatsbyDevelopProcess = spawnGatsbyProcess(`develop`)
gatsbyDevelopProcess.stdout.on("data", data => {
process.stdout.write(data)
if (data.toString().includes("http://localhost:8000")) {
resolve()
}
})
})
})

require(`../test-fns/index`)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/gatsby-source-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"devDependencies": {
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"jest": "^26.6.3",
"jest": "^27.2.1",
"node-fetch": "^2.6.1",
"rimraf": "^3.0.2",
"urling": "^1.0.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ exports.gatsbyCleanBeforeAll = async done => {
exports.spawnGatsbyProcess = (command = `develop`, env = {}) => {
const proc = spawn(
process.execPath,
[gatsbyBin, command, ...(command === `develop` ? ["-H", "localhost", "--port", "8000"] : [])],
[
gatsbyBin,
command,
...(command === `develop` ? ["-H", "localhost", "--port", "8000"] : []),
],
{
stdio: [`inherit`, `inherit`, `inherit`],
stdio: [`pipe`, `pipe`, `pipe`],
env: {
...process.env,
NODE_ENV: command === `develop` ? `development` : `production`,
Expand All @@ -35,7 +39,7 @@ exports.spawnGatsbyProcess = (command = `develop`, env = {}) => {
}
)

process.on('SIGINT', proc.kill)
process.on("SIGINT", proc.kill)

return proc
}
7 changes: 4 additions & 3 deletions integration-tests/images/jest-transformer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const babelPreset = require(`babel-preset-gatsby-package`)()
module.exports = require(`babel-jest`).createTransformer({
...babelPreset,
const babelJest = require(`babel-jest`)

module.exports = babelJest.default.createTransformer({
presets: [`babel-preset-gatsby-package`],
})
8 changes: 4 additions & 4 deletions integration-tests/images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"react-dom": "^16.9.0"
},
"devDependencies": {
"babel-preset-gatsby-package": "^1.3.0",
"babel-jest": "^24.0.0",
"jest": "^24.0.0",
"babel-preset-gatsby-package": "next",
"babel-jest": "^27.2.1",
"jest": "^27.2.1",
"pixelmatch": "^5.2.1"
}
}
}
6 changes: 3 additions & 3 deletions integration-tests/long-term-caching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"serve": "gatsby serve"
},
"dependencies": {
"gatsby": "^3.0.0-next.0",
"gatsby": "next",
"gray-percentage": "^2.0.0",
"react": "^16.9.0",
"react-dom": "^16.9.0"
},
"devDependencies": {
"babel-plugin-dynamic-import-node-sync": "^2.0.1",
"jest": "^24.0.0"
"jest": "^27.2.1"
}
}
}
6 changes: 3 additions & 3 deletions integration-tests/node-manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"author": "Tyler Barnes <tyler@gatsbyjs.com>",
"license": "ISC",
"dependencies": {
"gatsby": "3.6.0-next.1",
"gatsby": "next",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"fs-extra": "^10.0.0",
"jest": "^26.6.3",
"jest": "^27.2.1",
"rimraf": "^3.0.2",
"urling": "^1.0.7"
}
}
}
18 changes: 9 additions & 9 deletions integration-tests/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"gatsby": "^3.0.0-next.0",
"gatsby-plugin-postcss": "^3.3.0",
"gatsby": "next",
"gatsby-plugin-postcss": "next",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"tailwindcss": "1"
"tailwindcss": "^1.0.0"
},
"devDependencies": {
"cheerio": "^1.0.0-rc.9",
"cross-env": "^5.0.2",
"cross-env": "^7.0.3",
"execa": "^5.1.1",
"fs-extra": "^9.0.0",
"gatsby-core-utils": "^2.12.0",
"jest": "^24.0.0",
"jest-diff": "^24.0.0",
"fs-extra": "^10.0.0",
"gatsby-core-utils": "next",
"jest": "^27.2.1",
"jest-diff": "^27.2.0",
"jest-serializer-path": "^0.1.15",
"node-fetch": "^2.6.1",
"npm-run-all": "4.1.5",
Expand All @@ -44,4 +44,4 @@
"test-output": "node test-output.js",
"test:jest": "jest --runInBand"
}
}
}
2 changes: 1 addition & 1 deletion integration-tests/ssr/test-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function run() {
const { join } = require(`path`)
const fs = require(`fs-extra`)
const fetch = require(`node-fetch`)
const diff = require(`jest-diff`)
const { diff } = require(`jest-diff`)
const prettier = require(`prettier`)
const cheerio = require(`cheerio`)
const stripAnsi = require(`strip-ansi`)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/structured-logging/__tests__/ipc-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe(`IPC Send`, () => {
})
})

afterAll(async () => {
afterAll(() => {
gatsbyProcess.kill()
})

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/structured-logging/__tests__/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(`Activities`, () => {
let gatsbyProcess
let events = []

beforeAll(async done => {
beforeAll(done => {
gatsbyProcess = spawn(process.execPath, [gatsbyBin, `develop`], {
stdio: [`ignore`, `ignore`, `ignore`, `ipc`],
env: {
Expand All @@ -34,7 +34,7 @@ describe(`Activities`, () => {
})
})

afterAll(async () => {
afterAll(() => {
gatsbyProcess.kill()
})

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/structured-logging/__tests__/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe(`Successful Build`, () => {
let gatsbyProcess
let events = []

beforeAll(async done => {
beforeAll(done => {
gatsbyProcess = spawn(process.execPath, [gatsbyBin, `build`], {
// inherit lets us see logs in console
stdio: [`ignore`, `ignore`, `ignore`, `ipc`],
Expand Down Expand Up @@ -77,7 +77,7 @@ describe(`Failing Build`, () => {
let gatsbyProcess
let events = []

beforeAll(async done => {
beforeAll(done => {
fs.writeFileSync(
path.join(`src`, `pages`, `index.js`),
`import React from "react"
Expand Down