-
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-jsxcssandcss.resolvefunctionIn your code-base, make sure to import the
resolvefunction from the named export, like so:and not as property of the
cssfunction, i.e. do not do this:Mocking the
cssandcss.resolvefunctionCreate a mock file in the project root, adjacent to the
node_modulesfolder:./__mocks__/styled-jsx/css.js