mirror of
https://github.com/SamyRai/tercul-frontend.git
synced 2025-12-27 00:11:35 +00:00
fix: update Jest configuration for ES modules compatibility
- Configure Jest to work with ES modules (type: module in package.json) - Update Babel config with modules: false for proper ES module handling - Convert jest.setup.js to use ES module import syntax - Add experimental VM modules support for Jest execution Note: Testing infrastructure is in place but may need additional configuration for full compatibility with the project's ES module setup.
This commit is contained in:
parent
dfe69353f3
commit
6b3304d059
Binary file not shown.
@ -1,6 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/preset-env', { targets: { node: 'current' } }],
|
['@babel/preset-env', {
|
||||||
|
targets: { node: 'current' },
|
||||||
|
modules: false
|
||||||
|
}],
|
||||||
'@babel/preset-react',
|
'@babel/preset-react',
|
||||||
'@babel/preset-typescript',
|
'@babel/preset-typescript',
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
preset: null,
|
||||||
testEnvironment: 'jest-environment-jsdom',
|
testEnvironment: 'jest-environment-jsdom',
|
||||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||||
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
'\\\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
||||||
'\\\\.(gif|ttf|eot|svg|png)$': 'jest-transform-stub',
|
'\\\\.(gif|ttf|eot|svg|png)$': 'jest-transform-stub',
|
||||||
'^@/(.*)$': '<rootDir>/client/src/$1',
|
'^@/(.*)$': '<rootDir>/client/src/$1',
|
||||||
},
|
},
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\\\.[tj]sx?$': 'babel-jest',
|
'^.+\\\\.tsx?$': ['babel-jest', { useESM: true }],
|
||||||
},
|
},
|
||||||
transformIgnorePatterns: [
|
transformIgnorePatterns: [
|
||||||
'/node_modules/(?!wouter|lucide-react)/',
|
'/node_modules/(?!wouter|lucide-react)/',
|
||||||
|
|||||||
@ -1,5 +1 @@
|
|||||||
require('@testing-library/jest-dom');
|
import '@testing-library/jest-dom';
|
||||||
|
|
||||||
jest.mock('@/lib/queryClient', () => ({
|
|
||||||
apiRequest: jest.fn(),
|
|
||||||
}));
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
"check": "tsc",
|
"check": "tsc",
|
||||||
"lint": "tsc --noEmit",
|
"lint": "tsc --noEmit",
|
||||||
"test": "yarn test:unit && yarn test:e2e",
|
"test": "yarn test:unit && yarn test:e2e",
|
||||||
"test:unit": "jest",
|
"test:unit": "yarn jest",
|
||||||
"test:e2e": "playwright test"
|
"test:e2e": "playwright test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user