fix(mongodb-compass): Do not use postinstall to rebuild dependencies #2278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
packages/compass
postinstall script currently rebuilds application dependencies with electron-rebuild which causes them to be not compatible with node version that some test suites are using, this causes flakiness when running tests on GitHub CI (see #2277 and some other PRs where tests were failing with the similar error)This is safe to remove and will not affect Compass application packaging because when
hadron-build
packages the application it will rebuild native modules usingelectron-rebuild
after reinstalling application dependencies (see packages/hadron-build/commands/release.js#L366-L394)For some additional context the reason it's only causing issues some of the time is that in some test suites we rebuild those native modules to work in electron and then back to work in node after tests are finished, so if the stars are aligned correctly and the first test suite rebuilds native modules back to the node runtime, everything works fine.
Test runs in this PR will not really show that it fixes the issue as you need this specific order of tests running to make the issue appear, but I tried it locally against #2277 and all tests were passing with the fix applied on top of the branch