-
I'm making an Electron app that uses
I've tried to configure my way out of this with Jest but I can't seem to get it to transpile the module with Babel... module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/src/test-utils/setup-tests.ts'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/__mocks__/file-mock.ts',
'\\.svg$': '<rootDir>/src/__mocks__/svgr-mock.tsx',
'~/(.*)': '<rootDir>/src/$1',
},
slowTestThreshold: 30,
coveragePathIgnorePatterns: [
'/node_modules/',
'<rootDir>/src/graph/operations.ts',
],
timers: 'modern',
testEnvironment: 'jsdom',
globals: {
'ts-jest': {
babelConfig: {
presets: [['@babel/preset-env', { targets: { esmodules: false } }]],
plugins: [
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
],
},
},
},
transformIgnorePatterns: [],
transform: {
'\\.js$': 'babel-jest',
},
} Just to make sure I wasn't totally crazy, or there wasn't something else blocking me here in my tooling, I made a reproduction of my issue at https://github.com/tubbo/react-markdown-repro. If you So what do we do about this? How does anyone actually run a test that happens to include this module? I'm totally happy mocking it out for now just to keep things moving...just wondering how everyone who uses this component in the real world got past this problem in their testing phase? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Several test runners do support ESM. Did you try these steps? |
Beta Was this translation helpful? Give feedback.
Several test runners do support ESM.
Did you try these steps?