Switch build system to vite and update jest#32
Switch build system to vite and update jest#32daniel-heppner-ibigroup merged 29 commits intostorybook-9from
Conversation
This reverts commit eb40c0c.
| } | ||
| } | ||
|
|
||
| function getAbsolutePath(value) { |
There was a problem hiding this comment.
I removed this function. I'm not sure what its original function was, but it doesn't seem necessary anymore.
| */ | ||
| function isRunningJest() { | ||
| return process.env.JEST_WORKER_ID !== undefined; | ||
| } |
There was a problem hiding this comment.
this hasn't done anything for a long time since the snapshot tests don't run in jest since I did storybook 7 update
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
A few things I'm worried about. But it does work well
| </path> | ||
| </svg> | ||
| <span class="Alert__AlertHeader-sc-2vlo3n-2 fpauiN"> | ||
| <span class="sc-eqUAAy cHzsWi"> |
There was a problem hiding this comment.
We make use of the Alert__AlertHeader type classnames in some places. Is there any way to restore these?
There was a problem hiding this comment.
are you sure about that? If you look that classname contained a random styled component ID already- it wasn't just Alert__AlertHeader; it had -sc-2vlo3n-2 on there so it's not like you could use it as a selector anywhere that you don't have access to a regular expression. (like in CSS)
There was a problem hiding this comment.
I actually don't know why this changed. I guess it has something to do with the styled components plugin for vite. Since this classname is dynamically generated by the build step there's no guarantee that it will be consistent. For example, in OTP-RR these classnames are generated by the vite/webpack configuration in otp-rr, unrelated to the vite config that generated this snapshot. So relying on it is not safe because it depends on the consumer of the component.
There was a problem hiding this comment.
Here's an example of a selector we currently use: svg[class*="styled__FromIcon"] This needs to continue to work
There was a problem hiding this comment.
I figured it out and adjusted the config. However, it doesn't matter since the classnames in OTP-RR are generated by the config over there and this only affects the storybook output.
There was a problem hiding this comment.
The unit tests don't seem to have changed? What's going on
There was a problem hiding this comment.
wdym? The snapshots were updated in 0c3d19a.
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
I'm nervous, but things seem to be working (and much quicker!) So let's give it a go and worst case scenario we can revert
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
Dev mode starts much faster!
| import { | ||
| getLegRouteLongName, | ||
| getLegRouteShortName | ||
| } from "@opentripplanner/core-utils/lib/itinerary"; |
There was a problem hiding this comment.
These changes away from importing from lib are nice.
Co-authored-by: Binh Dam <56846598+binh-dam-ibigroup@users.noreply.github.com>
|
Before I merge this, please review the parent PR! Once it's merged into that it'll be harder to keep the changes separate. |
/lib/in various imports around the code. In some cases it was drilling in to a package to extract a type/property that wasn't exported, so I had to add it to the exports from the package's index file. This mostly had to do with core utils.