Usage with Jest & Vite #182
-
Hi there, Started using Stylex in a basic vite project (no SSR etc) using the unofficial stylex vite plugin and everything has been going swimmingly but my tests complain that "stylex.defineVars should never be called. It should be compiled away.", I presume I need to bootstrap the Stylex compiler somewhere in the testing but have no idea where to start. My Jest config looks like ...
TIA |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You need a
NOTE: make sure you only use these options for the test environment and not for your normal development and production builds. |
Beta Was this translation helpful? Give feedback.
You need a
.babelrc
file for Jest to compile StyleX. You should use the following values for the test environment.dev: true
test: true
runtimeInjection: false
NOTE: make sure you only use these options for the test environment and not for your normal development and production builds.