-
Notifications
You must be signed in to change notification settings - Fork 220
Description
When importing deepmerge with import * as merge from 'deepmerge'; throws Error: merge is not a function in the app, while the tests run just fine.
When importing with import merge from deepmerge;, the app works fine, but the jest tests throw TypeError: deepmerge_1.default is not a function`.
I have temporarily patched the issue in my code with an if/else block to reassign the correct function to the variable, but I feel there must be a better way.
Maybe jest is misconfigured. Has anyone ever encountered a similar issue or can provide a configuration template that is proven to be working?
This describes a similar issue to what I am experiencing aurelia/skeleton-navigation#606, though I am not using Aurelia, nor Moment. It just seems like the same kind of problem.
Node version: 8.6.0
NPM version: 5.5.1
Webpack version: 3.6.0
Typescript version: 2.5.3
deepmerge version: 2.0.1
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"module": "commonjs",
"target": "es5",
"lib": ["es7", "es2017", "dom"],
"jsx": "preserve",
"allowJs": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.ts"]
}.babelrc
{
"presets": ["env", "react"],
"plugins": [
"react-css-modules"
]
}jest.config.json
{
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"]
}