Comments (6)
@MatanBobi Our setup is a bit complicated.
We prebundle testing-library with tsup:
![image](https://private-user-images.githubusercontent.com/1035299/336790872-72581c73-b5dd-45a7-9d2d-30a2c5fea8d5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgwOTg3MzEsIm5iZiI6MTcxODA5ODQzMSwicGF0aCI6Ii8xMDM1Mjk5LzMzNjc5MDg3Mi03MjU4MWM3My1iNWRkLTQ1YTctOWQyZC0zMGEyYzVmZWE4ZDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MTFUMDkzMzUxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Njk0MDMwNWRhOTRlYmY5NzgwY2E5MDM5NTA4MzVhNzBmNTU0NGVhOGEzYzIwODkwZjk1OGIyZGVlOWZiZTBiMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.aRbv3eMr89RcYloi6dy0YgtsdO8O0H6sOWIMvfFRT9M)
But because tsup
somehow messes the types up during prebundling, we have @testing-library/dom
, @testing-library/jest-dom
and @testing-library/user-event
as a direct dependency, just for the types. But for the runtime of those packages we prebundle them.
We are considering 2 different scenario's.
- We stop prebundling
@testing-library/dom
,@testing-library/jest-dom
and@testing-library/user-event
, and make it a peer dependency as you suggested.
In this case, should all of them be a peer dep?
- We continue prebundling and try to find a workaround for the
tsup
issues, so that it will be an actualdevDependency
instead.
Will this also solve your issue?
from storybook.
AFAIR, @testing-library/jest-dom
doesn't rely on @testing-library/dom
at all so you can keep that there.
Regarding @testing-library/user-event
, I think it can also remain there as it already has a peer dependency on @testing-library/dom
and AFAIK it doesn't have any specific state that might conflict. So we can ask users to only install @testing-library/dom
as a peer dependency :)
from storybook.
Thanks for the reply @MatanBobi
And if we completely pre-bundle all of them (so make them devDependencies
instead), would that also solve your issue?
from storybook.
Hmmm, it's a good question. I'm not that much into the details of how the module resolution will work in that case. The problem we had was that inside RTL people who were using user-event sometimes received the DTL bundled with RTL and sometimes the one they've installed for user-event. Since I didn't experience this issue on my own but opened it due to a user commenting they're experiencing this issue I might not be the right person to say if it will work or not.
Here's the comment that raised the issue:
testing-library/react-testing-library#1216 (comment)
from storybook.
Okay, thanks for the context!
I think that issue is similar as this issue:
#27173
I just merged a PR, that at least uses the latest version of DTL, which I think will mitigate this issue a bit.
I do agree that we either should go for peerDeps or devDeps to fully resolve the issue.
I think that devDeps (prebundling) probably would be even more ideal, as it comes to this issue specifically.
Will keep you updated.
from storybook.
I think that issue is similar as this issue: #27173
Yes that definitely looks similar.
Thanks @kasperpeulen for the quick replies and attention :)
from storybook.
Related Issues (20)
- [Bug]: Cannot read properties of null (reading 'useContext')
- [Bug]: RSC stories that use "react-server" exports do not get bundled correctly HOT 5
- [Bug]: [Angular] argsToTemplate not showing correct value on "Show code" with input signals
- [Bug]: All `fn()` stubs get logged in the `Actions` panel, not just the component's args HOT 4
- [Bug]: subcomponents get type error HOT 1
- [Bug]: Backgrounds no longer working with Angular and MDX HOT 1
- [Bug]: Cleanup logs during storybook init
- [Bug]: Angular 18 Library: Missing documentations generated by compodoc within a Angular Library project setup HOT 1
- [Bug]: Component does not lose focus under specific circumstances (vuetify)
- [Bug]: Storybook builds twice on launch HOT 13
- [Bug]: Tailwind CSS Styles Not Applying in Next.js Application
- Make chromatic (firefox) repro for user event issues
- [Bug]: Angular outputPath object not supported (TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string.)
- [Bug]: Storybook installs, dies. HOT 2
- [Bug]: Support bun as a package manager HOT 4
- [Tracking]: Onboarding V2
- [Documentation]: Vite's `build` options are silently ignored HOT 1
- [Bug]: `BrandImage` resizes itself in dark theme when resizing sidebar
- Upgrade tsup to 8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook.