This is an automated email from the ASF dual-hosted git repository.
sadpandajoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 87d1abb21e6 chore(frontend): let JEST_MAX_WORKERS cap the Jest worker
pool locally (#45594)
87d1abb21e6 is described below
commit 87d1abb21e6e1610b4aa42b69d50a960a427fe69
Author: Evan Rusackas <[email protected]>
AuthorDate: Thu Oct 22 22:22:02 2026 +0100
chore(frontend): let JEST_MAX_WORKERS cap the Jest worker pool locally
(#45594)
Co-authored-by: Claude Fable 5.1 <[email protected]>
---
AGENTS.md | 1 +
docs/developer_docs/contributing/development-setup.md | 6 ++++++
docs/developer_docs/contributing/howtos.md | 3 +++
superset-frontend/jest.config.js | 4 ++++
superset-frontend/package.json | 4 ++--
5 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 0df0d789811..163faac85ae 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -200,6 +200,7 @@ The Developer Portal auto-generates MDX documentation from
Storybook stories. **
# Frontend
npm run test # All tests
npm run test -- filename.test.tsx # Single file
+JEST_MAX_WORKERS=2 npm run test -- filename.test.tsx # Cap workers on a
shared machine
# E2E Tests (Playwright)
npm run playwright:test # All Playwright tests
diff --git a/docs/developer_docs/contributing/development-setup.md
b/docs/developer_docs/contributing/development-setup.md
index 7e91b992e04..223253baec3 100644
--- a/docs/developer_docs/contributing/development-setup.md
+++ b/docs/developer_docs/contributing/development-setup.md
@@ -837,6 +837,12 @@ To run a single test file:
npm run test -- path/to/file.js
```
+Jest uses 80% of the machine's cores by default. On a shared or busy machine,
cap the worker pool with `JEST_MAX_WORKERS` (a number or a percentage):
+
+```bash
+JEST_MAX_WORKERS=2 npm run test -- path/to/file.js
+```
+
#### Known Issues and Workarounds
**Jest Test Hanging (MessageChannel Issue)**
diff --git a/docs/developer_docs/contributing/howtos.md
b/docs/developer_docs/contributing/howtos.md
index 786eca5fac6..65803d04375 100644
--- a/docs/developer_docs/contributing/howtos.md
+++ b/docs/developer_docs/contributing/howtos.md
@@ -173,6 +173,9 @@ npm run test -- --watch
# Run specific test file
npm run test -- MyComponent.test.tsx
+
+# Cap the worker pool (default is 80% of cores) on a shared or busy machine
+JEST_MAX_WORKERS=2 npm run test -- MyComponent.test.tsx
```
### E2E Integration Testing
diff --git a/superset-frontend/jest.config.js b/superset-frontend/jest.config.js
index 1ddc9590c23..a2017f4f217 100644
--- a/superset-frontend/jest.config.js
+++ b/superset-frontend/jest.config.js
@@ -124,4 +124,8 @@ export default {
},
reporters: reporters,
testTimeout: 20000,
+ // CI and the default use 80% of the cores. Set JEST_MAX_WORKERS (a number or
+ // a percentage string such as "50%") to cap the worker pool on a shared or
+ // busy machine without changing the npm scripts.
+ maxWorkers: process.env.JEST_MAX_WORKERS || '80%',
};
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index 430588dec84..aad393358c1 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -83,8 +83,8 @@
"storybook": "cross-env NODE_ENV=development BABEL_ENV=development
storybook dev -p 6006",
"test-storybook": "npx playwright test --config
.storybook/playwright.storybook-ci.config.ts",
"tdd": "cross-env NODE_ENV=test NODE_OPTIONS=\"--max-old-space-size=8192\"
jest --watch",
- "test": "cross-env NODE_ENV=test
NODE_OPTIONS=\"--max-old-space-size=8192\" jest --max-workers=80% --silent",
- "test-loud": "cross-env NODE_ENV=test
NODE_OPTIONS=\"--max-old-space-size=8192\" jest --max-workers=80%",
+ "test": "cross-env NODE_ENV=test
NODE_OPTIONS=\"--max-old-space-size=8192\" jest --silent",
+ "test-loud": "cross-env NODE_ENV=test
NODE_OPTIONS=\"--max-old-space-size=8192\" jest",
"type": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" tsc
--noEmit",
"update-maps": "cd plugins/plugin-chart-country-map/scripts && jupyter
nbconvert --to notebook --execute --inplace --allow-errors
--ExecutePreprocessor.timeout=1200 'Country Map GeoJSON Generator.ipynb'",
"validate-release": "../RELEASING/validate_this_release.sh"