javascript - jest trying to parse .css -
i have problem jest in no matters keeps trying parse css files javascript.
the files build webpack.
i have following configuration jest
"jest": { "rootdir": "./src", "modulenamemapper": { "^.*[.](css|css)$": "../jest/stylemock.js" } }, i tried script preprocessor strip css imports:
"jest": { "rootdir": "./src", "scriptpreprocessor": "../node_modules/jest-css-modules" }, it keeps throwing error.
({"object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){.button { ^ syntaxerror: unexpected token .
the best solution use modulenamemapper line in jest config, described in jest docs.
a minimal "ignore css" jest config, in package.json, might this
"jest": { "modulenamemapper": { "\\.(css|less)$": "<rootdir>/assets/css/__mocks__/stylemock.js" } }, then stylemock.js this
module.exports = {};
Comments
Post a Comment