Skip to content

css-modules-require-hook and jest #109

Open
@rodoabad

Description

@rodoabad

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions