routablehq / jest-scss-transform Goto Github PK
View Code? Open in Web Editor NEWA jest transformer for SCSS file exports
License: MIT License
A jest transformer for SCSS file exports
License: MIT License
Describe the bug
Using jest-scss-transform with Jest 28 produces an error: (ok in jest 27)
Invalid return value:
`process()` or/and `processAsync()` method of code transformer found at
"node_modules/jest-scss-transform/lib/index.js"
should return an object or a Promise resolving to an object. The object
must have `code` property with a string of processed code.
This error may be caused by a breaking change in Jest 28:
https://jestjs.io/docs/upgrading-to-jest28#transformer
Code Transformation Documentation:
https://jestjs.io/docs/code-transformation
Possibly relates to a change in jest v28
process()
andprocessAsync()
methods of a custom transformer module cannot return a string anymore. They must always return an object:
process(sourceText, sourcePath, options) {
- return `module.exports = ${JSON.stringify(path.basename(sourcePath))};`;
+ return {
+ code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`,
+ };
}
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Jest runs as expected
Environment (please complete the following information):
I have Vue CLI project, so I use vue.config.js and I am providing paths to SASS so it knows where to look for dependency files
includePaths: [
path.resolve(__dirname, 'src/styles'),
path.resolve(__dirname, 'src/WS_UIkit/src/styles'),
],
I am not familiar with this jest transformers, so I do not know whether it takes this configuration into account.. because it seems that it is not ๐คท
So I am looking for another way to provide this config to SASS but I didn't find it... it seems that SASS does not use some kind of sass.config.js
or similar.
Thanks for any hints ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.