-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS modules ($style) in next
branch
#268
Comments
Hi @lmiller1990, do you have an update on this ticket? It's been a while since you've created this issue, but it still hasn't been fixed IIRC. I really need this feature to properly test my Vue 3 components, so a follow up would be nice 🙂 |
If you want to try and implement it, I can help review and get it merged. I did not look into this yet. I don't think it will be too difficult, the SFC compiler will do most of the work. It also has typings so it's pretty easy to figure out how it works. |
@petervmeijgaard @lmiller1990 have either of you started working on this? i'm happy to spend a bit of time trying to solve it but don't want to duplicate efforts |
I have not started working on this, you are more than welcome too. I'd say you will need to look at the sfc-compiler code in vue core and see how it handles injecting css variables. Ping me if you need some help! |
@lmiller1990 There is an issue - to compile css modules with But jest latest stable version as of right now is 26.6.3, its transformer doen't support async behavior. We have to wait for jest v27 - they added |
To work around this in my codebase I made a wrapper for mount/shallowMount that injects a $style variable which simply returns whatever class is invoked. i.e, |
I think there should be some way of automatically loading a style tag into JSDOM when mounting. This would be consistent with how Vue files are used with the vue-loader. |
Ok, I can have a look. It looks like Jest 27 is available under the Can you share a test you'd like to write with this feature? We could use that as the test case when we work though implementing this. I have not used the |
Sorry for my joining in the middle of conversation. I really want to resolve this issue..!! I added test cases draft and code, all test works well. If there is something wrong, please let me know 🙇🏻 . I'll fix it soon !! |
Wow, awesome. Big release coming with this PR! |
I will release this in a day or two. thanks! |
It's out in 5.0.0-alpha.10. |
Ref: vuejs/test-utils#179
The text was updated successfully, but these errors were encountered: