Skip to content

Commit 3044bf0

Browse files
committed
Add a few improvements
1 parent efbffbc commit 3044bf0

File tree

5 files changed

+157
-136
lines changed

5 files changed

+157
-136
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ jobs:
512512
- name: Install node_modules
513513
run: ./scripts/yarn_install.sh
514514

515-
- run: yarn test:ci
515+
- run: yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
516516
working-directory: site
517517

518518
- uses: codecov/codecov-action@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ site/test-results/*
2727
site/e2e/test-results/*
2828
site/e2e/states/*.json
2929
site/playwright-report/*
30+
site/.swc
3031

3132
# Make target for updating golden files.
3233
cli/testdata/.gen-golden

site/jest.config.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
// REMARK: Jest is supposed to never exceed 50% maxWorkers by default. However,
2-
// there seems to be an issue with this in our Ubuntu-based workspaces.
3-
// If we don't limit it, then 100% CPU and high MEM usage is hit
4-
// unexpectedly, leading to OOM kills.
5-
//
6-
// SEE thread: https://github.com/coder/coder/pull/483#discussion_r829636583
7-
const maxWorkers = 2
1+
const maxWorkers = 8
82

93
module.exports = {
104
maxWorkers,
@@ -14,13 +8,21 @@ module.exports = {
148
roots: ["<rootDir>"],
159
setupFilesAfterEnv: ["./jest.setup.ts"],
1610
extensionsToTreatAsEsm: [".ts"],
17-
moduleNameMapper: {
18-
"^(\\.{1,2}/.*)\\.js$": "$1",
19-
},
2011
transform: {
21-
"^.+\\.tsx?$": [
22-
"ts-jest",
23-
{ tsconfig: "./tsconfig.test.json", useESM: true },
12+
"^.+\\.(t|j)sx?$": [
13+
"@swc/jest",
14+
{
15+
jsc: {
16+
transform: {
17+
react: {
18+
runtime: "automatic",
19+
},
20+
},
21+
experimental: {
22+
plugins: [["jest_workaround", {}]],
23+
},
24+
},
25+
},
2426
],
2527
},
2628
testEnvironment: "jsdom",

site/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"storybook": "start-storybook -p 6006",
2121
"storybook:build": "build-storybook",
2222
"test": "jest --selectProjects test",
23-
"test:ci": "jest --selectProjects test --silent",
23+
"test:ci": "jest --selectProjects test --silent --verbose",
2424
"test:coverage": "jest --selectProjects test --collectCoverage",
2525
"test:watch": "jest --selectProjects test --watch",
2626
"typegen": "xstate typegen 'src/**/*.ts'",
@@ -58,7 +58,7 @@
5858
"front-matter": "4.0.2",
5959
"history": "5.3.0",
6060
"i18next": "21.9.1",
61-
"jest-environment-jsdom": "^29.5.0",
61+
"jest-environment-jsdom": "29.5.0",
6262
"jest-location-mock": "1.0.9",
6363
"just-debounce-it": "3.1.1",
6464
"lodash": "4.17.21",
@@ -93,6 +93,8 @@
9393
"@storybook/addon-essentials": "6.5.12",
9494
"@storybook/addon-links": "6.5.9",
9595
"@storybook/react": "6.5.12",
96+
"@swc/core": "1.3.38",
97+
"@swc/jest": "0.2.24",
9698
"@testing-library/jest-dom": "5.16.4",
9799
"@testing-library/react": "13.4.0",
98100
"@testing-library/user-event": "14.4.3",
@@ -122,15 +124,15 @@
122124
"eslint-plugin-unicorn": "44.0.0",
123125
"jest": "29.5.0",
124126
"jest-canvas-mock": "2.4.0",
125-
"jest-fetch-mock": "^3.0.3",
127+
"jest-fetch-mock": "3.0.3",
126128
"jest-runner-eslint": "1.1.0",
127129
"jest-websocket-mock": "2.4.0",
130+
"jest_workaround": "0.1.14",
128131
"monaco-editor": "0.34.1",
129-
"msw": "^1.1.0",
132+
"msw": "1.1.0",
130133
"prettier": "2.8.1",
131134
"resize-observer": "1.0.4",
132135
"semver": "7.3.7",
133-
"ts-jest": "^29.0.5",
134136
"typescript": "4.8.2"
135137
},
136138
"browserslist": [

0 commit comments

Comments
 (0)