Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(test): fix javascript tests not running

Gabe Kangasd3cc2087ef28
diff --git a/web/.knip.json b/web/.knip.json
index e0783372cf..41d2e141d0 100644
--- a/web/.knip.json
+++ b/web/.knip.json
@@ -44,6 +44,8 @@
"@storybook/cli",
"@storybook/mdx2-csf",
"@commitlint/cli",
- "@commitlint/config-conventional"
+ "@commitlint/config-conventional",
+ "babel-plugin-dynamic-import-node",
+ "@babel/preset-react"
]
}
\ No newline at end of file
diff --git a/web/jest.config.js b/web/jest.config.js
index 8ffa537be0..5ee7c50cec 100644
--- a/web/jest.config.js
+++ b/web/jest.config.js
@@ -1,5 +1,24 @@
module.exports = {
- transform: { '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }] },
+ transform: {
+ '^.+\\.(js|jsx|ts|tsx)$': [
+ 'babel-jest',
+ {
+ presets: [
+ [
+ '@babel/preset-env',
+ {
+ targets: {
+ node: 'current',
+ },
+ },
+ ],
+ '@babel/preset-react',
+ '@babel/preset-typescript',
+ ],
+ plugins: ['dynamic-import-node'],
+ },
+ ],
+ },
testEnvironment: 'node',
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
diff --git a/web/package-lock.json b/web/package-lock.json
index a66f440916..2883afa0dc 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -22,6 +22,7 @@
"@xstate/react": "3.2.2",
"antd": "4.24.16",
"autoprefixer": "^10.4.14",
+ "babel-plugin-dynamic-import-node": "^2.3.3",
"chart.js": "^4.2.0",
"classnames": "2.5.1",
"date-fns": "^3.0.0",
@@ -55,6 +56,7 @@
},
"devDependencies": {
"@babel/core": "7.25.8",
+ "@babel/preset-react": "^7.25.7",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@mdx-js/react": "3.0.1",
@@ -13471,6 +13473,15 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/babel-plugin-dynamic-import-node": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
+ "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "object.assign": "^4.1.0"
+ }
+ },
"node_modules/babel-plugin-istanbul": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz",
diff --git a/web/package.json b/web/package.json
index ccaa5cadc4..d428e817e4 100644
--- a/web/package.json
+++ b/web/package.json
@@ -31,6 +31,7 @@
"@xstate/react": "3.2.2",
"antd": "4.24.16",
"autoprefixer": "^10.4.14",
+ "babel-plugin-dynamic-import-node": "^2.3.3",
"chart.js": "^4.2.0",
"classnames": "2.5.1",
"date-fns": "^3.0.0",
@@ -64,6 +65,7 @@
},
"devDependencies": {
"@babel/core": "7.25.8",
+ "@babel/preset-react": "^7.25.7",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@mdx-js/react": "3.0.1",
@@ -135,4 +137,4 @@
"ts-jest": "^29.1.0",
"typescript": "5.6.3"
}
-}
\ No newline at end of file
+}