GithubHelp home page GithubHelp logo

routablehq / jest-scss-transform Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 6.0 42 KB

A jest transformer for SCSS file exports

License: MIT License

JavaScript 90.74% CSS 0.09% SCSS 9.17%
javascript jest scss transform

jest-scss-transform's People

Contributors

laudebugs avatar sebestajozef avatar sheminusminus avatar zigcccc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jest-scss-transform's Issues

Jest 28 error 'invalid return value' with process() or/and processAsync()

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() and processAsync() 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:

  1. Configure jest with jest-scss-transform.
  2. Use jest 28

Expected behavior

Jest runs as expected

Environment (please complete the following information):

  • Windows 11 21H2 22000.613
  • jest-scc-transform v1.0.2
  • Jest v28.0.3
  • Node v16.14.2

How can one provide includePaths (File to import not found or unreadable)

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 ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.