Install jest
, and jest-runner-sass-true
, sass-true
yarn add --dev jest jest-runner-sass-true sass-true
# or with NPM
npm install --save-dev jest jest-runner-sass-true sass-true
In your package.json
{
"jest": {
"projects": [
{
"runner": "jest-runner-sass-true",
"displayName": "SASS",
"moduleFileExtensions": ["scss"],
"testMatch": [
"<rootDir>/src/**/__tests__/*.scss"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"globals": {
"//": "Change to `true` to see the trace log",
"trace": false
}
}
]
}
}
Or in jest.config.json
module.exports = {
"projects": [
{
"runner": "jest-runner-sass-true",
"displayName": "SASS",
"moduleFileExtensions": ["scss"],
"testMatch": [
"<rootDir>/src/**/__tests__/*.scss"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"globals": {
"//": "Change to `true` to see the trace log",
"trace": false
}
}
]
}
yarn jest
# or with config file
jest --config ./jest.config.json