getFileScope() throws in Jest tests after Sprinkles upgrade from 0.4.3 to 1.0.0 #264
-
This could be related to composeStyles used in Sprinkles 1.0 as mentioned in https://twitter.com/markdalgleish/status/1420984688416464898 After upgrading Sprinkles to 1.0.0 our Jest render tests fail due to empty files scopes: function getFileScope() {
if (fileScopes.length === 0) {
throw new Error(dedent__default['default']`
Styles were unable to be assigned to a file. This is generally caused by one of the following:
- You may have created styles outside of a '.css.ts' context
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/setup
`);
}
return fileScopes[0];
} From the looks of it, when our components call the sprinkles function during render to get back an atomic class name, composeStyles expects to be able to generate an identifier which then throws the error above. Not sure what's going on here. The components work as expected during regular use in the browser, so this could be an issue with how Jest loads modules during test execution. Any advise on how to proceed? For now we'd had to postpone the Sprinkles upgrade. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks for raising this. We should get this sorted out soon. |
Beta Was this translation helpful? Give feedback.
-
Fixed in |
Beta Was this translation helpful? Give feedback.
Thanks for raising this. We should get this sorted out soon.