#I have this setup in my jest config.
moduleNameMapper: {
'^.+\\.(scss)$': '<rootDir>/test/utils/css-hooks.js'
},
const hook = require('css-modules-require-hook');
const sass = require('node-sass');
hook({
extensions: [
'.scss'
],
preprocessCss: (data, file) => {
return sass.renderSync({ // eslint-disable-line no-sync
data,
file
}).css;
}
});
When I use mocha this resolves to _styles_header__styles which is something I can test against.
// mocha.opts
--require ./test/utils/css-hooks.js
However, in jest this returns undefined.