fix(test): fix javascript tests not running

This commit is contained in:
Gabe Kangas 2024-10-19 15:28:41 -07:00
parent 742df5322f
commit df3a9424b1
4 changed files with 37 additions and 3 deletions

View file

@ -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"
]
}

View file

@ -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'],

11
web/package-lock.json generated
View file

@ -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",

View file

@ -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"
}
}
}