Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

how to make jest parse the imported css modules in create react app

// add a jest.config.js to the project with this content
const config = {
    verbose: true,
    "moduleNameMapper": {
        ".(scss|less)$": "<rootDir>/config/CSSStub.js"
    }
}

module.exports = config;

// Or async function
module.exports = async() => {
    return {
        verbose: true,
    };
};
 
PREVIOUS NEXT
Tagged: #jest #parse #imported #css #modules #create #react #app
ADD COMMENT
Topic
Name
8+6 =