test: improve chromatic-e2e related tests#1273
Conversation
|
📦 Package Size: 5732 KB |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1273 +/- ##
==========================================
+ Coverage 77.37% 77.98% +0.60%
==========================================
Files 189 189
Lines 3624 3624
Branches 1089 1089
==========================================
+ Hits 2804 2826 +22
+ Misses 705 686 -19
+ Partials 115 112 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
codykaup
left a comment
There was a problem hiding this comment.
Looks good! Just a couple non-blocking questions for you.
| * it works. Internally `require.resolve` calls `Module._resolveFilename` so we | ||
| * can intercept it. | ||
| */ | ||
| function patchModulePath(from: string, to: string) { |
There was a problem hiding this comment.
Looks like this function exists in a couple places. Do you think it's worth pulling out into a shared function (similar to testLogger)?
If we do that, I would exclude it from our test coverage output as well!
There was a problem hiding this comment.
Good call. Addressed both findings in 36f30f1.
| - 'CHANGELOG.md' | ||
| - 'vitest.no-threads.config.ts' | ||
| - '**/lib/testLogger.ts' | ||
| - '**/lib/testUtilities.ts' |
There was a problem hiding this comment.
Thanks for updating this too! 🎉
|
🚀 PR was released in |
Another split from #1252. Contains test improvements that are unrelated to
--vitestfeature itself.node:testimports. These are not run during Vitest test run.patchModulePathfor "mocking"require.resolve. Feel free to point out if this is too hacky and should be removed. As far as I know, this is the only way to "mock"require.resolve.--playwrightand--cypressoptions📦 Published PR as canary version:
16.1.1--canary.1273.24121882580.0✨ Test out this PR locally via:
npm install chromatic@16.1.1--canary.1273.24121882580.0 # or yarn add chromatic@16.1.1--canary.1273.24121882580.0