-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fix path splitting issues on windows #3565
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
eb5fd8c
to
c7a16c4
Compare
@@ -38,7 +38,7 @@ export async function renameProjectDirectory( | |||
|
|||
// Make sure the new name does not exist. | |||
const newPath = window.electron.path.join( | |||
projectPath.split('/').slice(0, -1).join('/'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jesus we need a lint for shit like this haha makes me nervous just looking at it
@iterion i think you need to run yarn fmt |
yes, idgaf about that until i'm done lol, editor formats it in a completely different way so I just disable it and format once i'm done. |
9425132
to
2e3e559
Compare
61c75a7
to
4dbff3d
Compare
4bcaa02
to
aa4807a
Compare
currentFileName: currentFileName, | ||
currentFilePath: id, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we unit test in the same way as the rust tests were, only becaiuse there were lots of regression tests in those unit tests, aka those little shits are load bearing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can unit test as-is, I took a lot of stuff out because it seems unnecessary. Like, the old code was not using half of the function because of a bug with how config was passed in a json, we were just getting lucky before that this worked even with unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know any of the specific functionality regressions I could write e2e tests for those too, to make sure I didn't cut out currently important stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly files w spaces, either url encoded or not were weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk if applies here
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3565 +/- ##
==========================================
- Coverage 87.90% 87.83% -0.07%
==========================================
Files 67 67
Lines 26150 25960 -190
==========================================
- Hits 22986 22803 -183
+ Misses 3164 3157 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e2ce647
to
bb43e48
Compare
* Fix: on settings close go back to the same file * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * shit aint working yo * Get that page a-loading * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
64fce91
to
2e65211
Compare
2e65211
to
8b8883e
Compare
src/lib/paths.test.ts
Outdated
// @ts-ignore | ||
global.window = { electron: { path: path } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't get cleaned up between runs. I really don't like modifying global
. It's easy to make mistakes like this. Here, it introduces test order dependence, and that's a best case scenario. I'd much prefer having abstraction functions. But if we really can't get around it, I think we need to move this to a beforeEach()
and in an afterEach()
, remove it from global
. This way, if there's an exception, it still cleans up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched to just injecting path into the function, we can then remove onDesktop as a param as it basically just checks if it's electron, and we know it's electron when window.electron.path
is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, that's broken though, not working when I test it. Maybe back to beforeEach for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can then remove onDesktop as a param as it basically just checks if it's electron, and we know it's electron when
window.electron.path
is defined.
I think this makes sense. Then add a local var like this.
const isDesktop = !!pathlib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
False alarm, CI looks pretty good outside of the known flakes. I tested again locally after rebuilding everything and it worked there too.
7df09aa
to
1207c65
Compare
It's not safe to assume files are delimited by
/
. Instead, electron re-exports the node path lib which we can use for dirname, basename, etc.I found another occurence of this that must be causing some bugs somewhere in routeLoaders. I've fixed it and verified it still works on linux.
I haven't tested this on windows yet, but everything still functions on linux so it's at least notionally better. I'll work on getting a dev env on my windows machine.