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

Tests: Fix unit test timeouts #25954

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-react": "^3.0.1",
"@vitest/coverage-v8": "^1.0.1",
"@vitest/coverage-v8": "^1.2.2",
"chromatic": "7.1.0",
"concurrently": "^5.3.0",
"cross-env": "^7.0.3",
Expand Down Expand Up @@ -220,7 +220,7 @@
"util": "^0.12.4",
"vite": "^4.0.0",
"vite-plugin-turbosnap": "^1.0.1",
"vitest": "^1.0.1",
"vitest": "^1.2.2",
"wait-on": "^7.0.1"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions code/vitest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ignoreList = [
error.message.match(
/React will try to recreate this component tree from scratch using the error boundary you provided/
),
(error: any) => error.message.includes('Lit is in dev mode. Not recommended for production!'),
];

const throwMessage = (type: any, message: any) => {
Expand Down
16 changes: 16 additions & 0 deletions code/vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,26 @@ export default defineWorkspace([
'renderers/*/vitest.config.ts',
]);

/**
* CircleCI reports the wrong number of threads to Node.js, so we need to set it manually.
* Unit tests are running with the xlarge resource class, which has 8 vCPUs.
* @see https://jahed.dev/2022/11/20/fixing-node-js-multi-threading-on-circleci/
* @see https://vitest.dev/config/#pooloptions-threads-maxthreads
* @see https://circleci.com/docs/configuration-reference/#x86
* @see .circleci/config.yml#L214
*/
const threadCount = process.env.CI ? 8 : undefined;

export const vitestCommonConfig = defineConfig({
test: {
clearMocks: true,
setupFiles: [resolve('./vitest-setup.ts')],
globals: true,
poolOptions: {
threads: {
minThreads: threadCount,
maxThreads: threadCount,
},
},
},
});
154 changes: 81 additions & 73 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.4, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6":
"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.4, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6":
version: 7.23.6
resolution: "@babel/parser@npm:7.23.6"
bin:
Expand Down Expand Up @@ -2238,7 +2238,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.4, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6":
"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.4, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6":
version: 7.23.6
resolution: "@babel/types@npm:7.23.6"
dependencies:
Expand Down Expand Up @@ -6418,7 +6418,7 @@ __metadata:
"@typescript-eslint/experimental-utils": "npm:^5.62.0"
"@typescript-eslint/parser": "npm:^6.18.1"
"@vitejs/plugin-react": "npm:^3.0.1"
"@vitest/coverage-v8": "npm:^1.0.1"
"@vitest/coverage-v8": "npm:^1.2.2"
chromatic: "npm:7.1.0"
concurrently: "npm:^5.3.0"
cross-env: "npm:^7.0.3"
Expand Down Expand Up @@ -6455,7 +6455,7 @@ __metadata:
util: "npm:^0.12.4"
vite: "npm:^4.0.0"
vite-plugin-turbosnap: "npm:^1.0.1"
vitest: "npm:^1.0.1"
vitest: "npm:^1.2.2"
wait-on: "npm:^7.0.1"
dependenciesMeta:
ejs:
Expand Down Expand Up @@ -8416,9 +8416,9 @@ __metadata:
languageName: node
linkType: hard

"@vitest/coverage-v8@npm:^1.0.1":
version: 1.0.4
resolution: "@vitest/coverage-v8@npm:1.0.4"
"@vitest/coverage-v8@npm:^1.2.2":
version: 1.2.2
resolution: "@vitest/coverage-v8@npm:1.2.2"
dependencies:
"@ampproject/remapping": "npm:^2.2.1"
"@bcoe/v8-coverage": "npm:^0.2.3"
Expand All @@ -8428,25 +8428,14 @@ __metadata:
istanbul-lib-source-maps: "npm:^4.0.1"
istanbul-reports: "npm:^3.1.6"
magic-string: "npm:^0.30.5"
magicast: "npm:^0.3.2"
magicast: "npm:^0.3.3"
picocolors: "npm:^1.0.0"
std-env: "npm:^3.5.0"
test-exclude: "npm:^6.0.0"
v8-to-istanbul: "npm:^9.2.0"
peerDependencies:
vitest: ^1.0.0
checksum: e4fb7e7f818a320dcef451193a6aba7b4173a3246695fb5c7b406251c860e10a02f41c3a9678301d6d14e9453bef16de5624658bc3abc11775c708bb20f15ace
languageName: node
linkType: hard

"@vitest/expect@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/expect@npm:1.0.4"
dependencies:
"@vitest/spy": "npm:1.0.4"
"@vitest/utils": "npm:1.0.4"
chai: "npm:^4.3.10"
checksum: a5f3d0ab334938cd70f4d2b44205885532d3d24466617a3c4a230378b6cfa0b5de5f5d9ce80e48508c3cc02dfde1f064ea1126912d7e9f46e18b305b41417f2a
checksum: 90e3cfdc7d36df86f95b4bc372851dbf0a9e78ca9d80177674ebb30cf5dff1e786660016aa7e369bd30ac7d1d3edc18d7ab0f6ccfdc9cdfe04ada0e0b5d5911a
languageName: node
linkType: hard

Expand All @@ -8461,6 +8450,17 @@ __metadata:
languageName: node
linkType: hard

"@vitest/expect@npm:1.2.2":
version: 1.2.2
resolution: "@vitest/expect@npm:1.2.2"
dependencies:
"@vitest/spy": "npm:1.2.2"
"@vitest/utils": "npm:1.2.2"
chai: "npm:^4.3.10"
checksum: 920e80b956d9d5ef7909cbe2bf883c8556da11c5123ea037396cb672d7038116c9773bd36915a3df7be2ffd76b661d5a6487e7e5ded78f39e2500cb36ae81e59
languageName: node
linkType: hard

"@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch":
version: 1.1.3
resolution: "@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch::version=1.1.3&hash=8fb073"
Expand All @@ -8472,34 +8472,25 @@ __metadata:
languageName: node
linkType: hard

"@vitest/runner@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/runner@npm:1.0.4"
"@vitest/runner@npm:1.2.2":
version: 1.2.2
resolution: "@vitest/runner@npm:1.2.2"
dependencies:
"@vitest/utils": "npm:1.0.4"
"@vitest/utils": "npm:1.2.2"
p-limit: "npm:^5.0.0"
pathe: "npm:^1.1.1"
checksum: 4e60471997cbac61c2b7f5e8c701a7459ed51177c709f27c53ffa1e889097782132d21ed816c10cf3bf5dadf82e973c65d6e2210f77aba19f8be9d5e9a1a1002
checksum: 25a9c03cca5b40738fe606757b14ee9d60d25193115b4674e3cc402c2b2c3844d234902d48bfa7646cb205455ea27891fef96733e033a570b85fe74ed29ff81c
languageName: node
linkType: hard

"@vitest/snapshot@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/snapshot@npm:1.0.4"
"@vitest/snapshot@npm:1.2.2":
version: 1.2.2
resolution: "@vitest/snapshot@npm:1.2.2"
dependencies:
magic-string: "npm:^0.30.5"
pathe: "npm:^1.1.1"
pretty-format: "npm:^29.7.0"
checksum: 77fc4a7b74f4bce56bfa7ff5bfefa5d9a7511988d3e7e7fc798a877325ed3db4a3252fa343adff1c77482bc18e69f7279290d165fe5688d8f63a4266d2d716a8
languageName: node
linkType: hard

"@vitest/spy@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/spy@npm:1.0.4"
dependencies:
tinyspy: "npm:^2.2.0"
checksum: dece5db1aabc667a549d6e0a382d338fa0bfee684aadf4695d0633e1e30e11ad244d0be2163238598e615dfea683b73b2b095e89cc4854a2a2d6cb528c4bfca8
checksum: 0f8a69a289aa6466c7dd56f8327190d56a0bc7ad10412127de001c94784f6dba5e5bccb757def21f565f4efa3e00c307b92e8b6c302f11fc57889b743ba18a95
languageName: node
linkType: hard

Expand All @@ -8512,14 +8503,12 @@ __metadata:
languageName: node
linkType: hard

"@vitest/utils@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/utils@npm:1.0.4"
"@vitest/spy@npm:1.2.2":
version: 1.2.2
resolution: "@vitest/spy@npm:1.2.2"
dependencies:
diff-sequences: "npm:^29.6.3"
loupe: "npm:^2.3.7"
pretty-format: "npm:^29.7.0"
checksum: 4a87f98b9192f544a6d52232ed1605ac9a6d7418e35de40b4ef36d0d0f6905112a9a21f1393e16f47838e67992399958d524e6b99f6a3583c0a0527fa7557e49
tinyspy: "npm:^2.2.0"
checksum: 5480048d26c0d82b524317552fbdcc05fed6ea626d887620647826453a344798a360f2a75af477512a1569b1b6c918eae62338e8b35575f875fc2d7ef51419f3
languageName: node
linkType: hard

Expand All @@ -8535,6 +8524,18 @@ __metadata:
languageName: node
linkType: hard

"@vitest/utils@npm:1.2.2":
version: 1.2.2
resolution: "@vitest/utils@npm:1.2.2"
dependencies:
diff-sequences: "npm:^29.6.3"
estree-walker: "npm:^3.0.3"
loupe: "npm:^2.3.7"
pretty-format: "npm:^29.7.0"
checksum: 32449cb7eca8ecea56e0fce280c9770f65fa6b60bbba73be06ca2891096818899b4b3220bd3c815df8beb4266034db394fcf235e4de8959cce686b8b360948d1
languageName: node
linkType: hard

"@vitest/utils@npm:^0.34.6":
version: 0.34.7
resolution: "@vitest/utils@npm:0.34.7"
Expand Down Expand Up @@ -9183,13 +9184,20 @@ __metadata:
languageName: node
linkType: hard

"acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.3.0":
"acorn-walk@npm:^8.1.1":
version: 8.3.1
resolution: "acorn-walk@npm:8.3.1"
checksum: a23d2f7c6b6cad617f4c77f14dfeb062a239208d61753e9ba808d916c550add92b39535467d2e6028280761ac4f5a904cc9df21530b84d3f834e3edef74ddde5
languageName: node
linkType: hard

"acorn-walk@npm:^8.3.2":
version: 8.3.2
resolution: "acorn-walk@npm:8.3.2"
checksum: 7e2a8dad5480df7f872569b9dccff2f3da7e65f5353686b1d6032ab9f4ddf6e3a2cb83a9b52cf50b1497fd522154dda92f0abf7153290cc79cd14721ff121e52
languageName: node
linkType: hard

"acorn@npm:^7.1.1, acorn@npm:^7.4.1":
version: 7.4.1
resolution: "acorn@npm:7.4.1"
Expand Down Expand Up @@ -19428,14 +19436,14 @@ __metadata:
languageName: node
linkType: hard

"magicast@npm:^0.3.2":
version: 0.3.2
resolution: "magicast@npm:0.3.2"
"magicast@npm:^0.3.3":
version: 0.3.3
resolution: "magicast@npm:0.3.3"
dependencies:
"@babel/parser": "npm:^7.23.3"
"@babel/types": "npm:^7.23.3"
"@babel/parser": "npm:^7.23.6"
"@babel/types": "npm:^7.23.6"
source-map-js: "npm:^1.0.2"
checksum: cd157b250d962ccdb313f250509220f10ad63f673d88a0a001d201fd2b2dae90c6c65c4e9b6ce164f05c25c400139715edce750e3e2f41b5a249e29225d6c4fb
checksum: 2eeba19545ac4328433be817bd81fcfa8a517ec67599260541e13ce5ce18b27ff8830f1b87d54a1392d408d1b96e44938bf026920f0110edbdfecc96980919b3
languageName: node
linkType: hard

Expand Down Expand Up @@ -27426,10 +27434,10 @@ __metadata:
languageName: node
linkType: hard

"tinypool@npm:^0.8.1":
version: 0.8.1
resolution: "tinypool@npm:0.8.1"
checksum: d965c057a1866c9d83716f4e434f7be18b2a067ed3b32cc2de3b3bf34ca1756ac1c35bd04433e2086c8cc2afa75b328e4b17baa6b4e6292dba2ce31cc76770e0
"tinypool@npm:^0.8.2":
version: 0.8.2
resolution: "tinypool@npm:0.8.2"
checksum: 8998626614172fc37c394e9a14e701dc437727fc6525488a4d4fd42044a4b2b59d6f076d750cbf5c699f79c58dd4e40599ab09e2f1ae0df4b23516b98c9c3055
languageName: node
linkType: hard

Expand Down Expand Up @@ -28823,9 +28831,9 @@ __metadata:
languageName: node
linkType: hard

"vite-node@npm:1.0.4":
version: 1.0.4
resolution: "vite-node@npm:1.0.4"
"vite-node@npm:1.2.2":
version: 1.2.2
resolution: "vite-node@npm:1.2.2"
dependencies:
cac: "npm:^6.7.14"
debug: "npm:^4.3.4"
Expand All @@ -28834,7 +28842,7 @@ __metadata:
vite: "npm:^5.0.0"
bin:
vite-node: vite-node.mjs
checksum: 3be4f8045a2c39afb57fdf83450791f872b10f883728eb58495640eed8d370f062a8bf25622afd005be8b375a1b4ac5731ca4fa0ae7c962742acf8f904f7748a
checksum: 39a5b9d9c806a012aab208eee0f59e4e12446ec19a4cf149a6459e7ff86491c289e189fda4f55a63b7e37d713f5edbda0e9efed95af4f7ebefa6d39eee093c0b
languageName: node
linkType: hard

Expand Down Expand Up @@ -28977,16 +28985,16 @@ __metadata:
languageName: node
linkType: hard

"vitest@npm:^1.0.1":
version: 1.0.4
resolution: "vitest@npm:1.0.4"
dependencies:
"@vitest/expect": "npm:1.0.4"
"@vitest/runner": "npm:1.0.4"
"@vitest/snapshot": "npm:1.0.4"
"@vitest/spy": "npm:1.0.4"
"@vitest/utils": "npm:1.0.4"
acorn-walk: "npm:^8.3.0"
"vitest@npm:^1.2.2":
version: 1.2.2
resolution: "vitest@npm:1.2.2"
dependencies:
"@vitest/expect": "npm:1.2.2"
"@vitest/runner": "npm:1.2.2"
"@vitest/snapshot": "npm:1.2.2"
"@vitest/spy": "npm:1.2.2"
"@vitest/utils": "npm:1.2.2"
acorn-walk: "npm:^8.3.2"
cac: "npm:^6.7.14"
chai: "npm:^4.3.10"
debug: "npm:^4.3.4"
Expand All @@ -28998,9 +29006,9 @@ __metadata:
std-env: "npm:^3.5.0"
strip-literal: "npm:^1.3.0"
tinybench: "npm:^2.5.1"
tinypool: "npm:^0.8.1"
tinypool: "npm:^0.8.2"
vite: "npm:^5.0.0"
vite-node: "npm:1.0.4"
vite-node: "npm:1.2.2"
why-is-node-running: "npm:^2.2.2"
peerDependencies:
"@edge-runtime/vm": "*"
Expand All @@ -29024,7 +29032,7 @@ __metadata:
optional: true
bin:
vitest: vitest.mjs
checksum: 401cd3f7bc716269ed2e4d6304b3377a3957370f9ca1565d0fb328b3eb0017ba627e0357ccf7bf29126750ef312cc9e5319af8b5cfa87c3f746732480bebb813
checksum: 085cb62146191b32dc98fac1a5b0de6d1c63c44cc1e7946a7d38309dd4135539432ec27b4bfad38ce79736688a0ce20d9b93f58de4ce4a41677cb3c5ca6ad980
languageName: node
linkType: hard

Expand Down
4 changes: 2 additions & 2 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"@types/window-size": "^1.1.3",
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "^6.18.1",
"@vitest/coverage-v8": "^1.0.1",
"@vitest/coverage-v8": "^1.2.2",
"ansi-regex": "^5.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^9.1.2",
Expand Down Expand Up @@ -179,7 +179,7 @@
"typescript": "~5.2.2",
"util": "^0.12.4",
"uuid": "^9.0.0",
"vitest": "^1.0.1",
"vitest": "^1.2.2",
"wait-on": "^7.0.1",
"window-size": "^1.1.1",
"yaml": "^2.3.1",
Expand Down
Loading
Loading