jestjs - How to use a specific webpack config file for running Jest? -


i trying write test using jest , import es6 module. using webpack3 , jest 21.0.2. test code starts with

import const 'util/const'; 

this throws error "syntaxerror: unexpected token import". have development.webpack.config.js , production.webpack.config.js files development , production build. webpack.config.js files reads env variable , determines file refer.

below code part of development.webpack.config.js handle error:

env: {     test: {         presets:['react',["es2015"]],         plugins: ["transform-es2015-modules-commonjs", "dynamic-import-node"]     } } 

it seems when run npm test, jest not referring development.webpack.config.js. there way set specific webpack config file when running jest?


Comments

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -