-
Notifications
You must be signed in to change notification settings - Fork 21
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
Look for Firefox in HKCU as well as HKLM (fix #73) #74
Conversation
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.
Implementation looks OK.
Could you add a unit test to verify the expected behavior in test/run/utils.js
?
I'm not sure how to do this since I probably shouldn't be modifying registry keys for automated tests. Any ideas? |
That test file mocks the node-fx-runner/test/run/test.utils.js Lines 163 to 177 in f1f0358
|
I have added a new test for the expected behaviour and slightly modified the old registry test to ensure it checks the old behaviour* is consistent (so if you only have keys in HKLM it still finds the path). Edit as per this comment: |
test/run/test.utils.js
Outdated
var expected = "fake\\binary\\path"; | ||
|
||
// see ./mock-winreg.js | ||
// Only mock keys in HKLM (local machine) hive |
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 suppose that you changed the implementation to veify that the logic still works as intended when there is a HKLM-only registry key (i.e. without HKCU)? Can you clarify that intent in the comment, since it isn't obvious.
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.
That's right. If you have all the correct keys in HKLM and some missing in HKCU the intended behaviour (as I see it) is to ignore HKCU and fall back on HKLM for all the keys. I also edited the comment above clarifying this. The code fails any access to HKCU to mimic the missing keys.
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 meant in a code comment, not here :)
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.
Haha, I thought it was a strange ask :P Will do.
Also removes an incorrect comment from the new case
Thanks for the patch and quick responses! |
Fix for #73. After revising my approach I'm fairly certain it works correctly. I extracted a couple of functions from
normalizeBinary
for getting the relevant registry values as promises and test in turn both registry hives before falling back on the standard program files path as before.Tested by editing the registry to the following circumstances: