Skip to content

Commit bf1026b

Browse files
committed
Fix failing unit tests
* This PR caused the Sidebar.test.ts file tests to fail because TransformStream is not found. * TransformStream exists in the Node version I'm testing with (20), but it still isn't found by Jest * Turns out it is a problem with Jest, and the workaround is the simple package jest-fixed-jsdom, which subclasses JSDOMEnvironment testing environment, placing this and several other dependencies in its global object. * In package.json - add jest-fixed-jsdom as a devDependency * In jest.config.cjs - change testEnvironment to jest-fixed-jsdom
1 parent 498e49e commit bf1026b

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

client/jest.config.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
preset: "ts-jest",
3-
testEnvironment: "jsdom",
3+
testEnvironment: "jest-fixed-jsdom",
44
moduleNameMapper: {
55
"^@/(.*)$": "<rootDir>/src/$1",
66
"\\.css$": "<rootDir>/src/__mocks__/styleMock.js",

package-lock.json

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@types/jest": "^29.5.14",
5353
"@types/node": "^22.7.5",
5454
"@types/shell-quote": "^1.7.5",
55+
"jest-fixed-jsdom": "^0.0.9",
5556
"prettier": "3.3.3",
5657
"typescript": "^5.4.2"
5758
}

0 commit comments

Comments
 (0)