-
BackgroundThe above setup is required to prevent a problem that arises when using calls to function css() {}
css.resolve = function() {};
module.exports = css; Now, this is quite irregular, but perfectly valid JavaScript, so it would be very logical to think that the mocked version could follow the same pattern. However, By always calling the Migrated from gotchas |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
TL;DR (recommended setup)Usage of
|
Beta Was this translation helpful? Give feedback.
TL;DR (recommended setup)
Usage of
styled-jsx
css
andcss.resolve
functionIn your code-base, make sure to import the
resolve
function from the named export, like so:and not as property of the
css
function, i.e. do not do this:Mocking the
css
andcss.resolve
functionCreate a mock file in the project root, adjacent to the
node_modules
folder:./__mocks__/styled-jsx/css.js