Repository navigation
test: isolate tests from the real keychain and home directory - #741
Open
arjankowski wants to merge 1 commit into
Open
arjankowski wants to merge 1 commit into
arjankowski wants to merge 1 commit into
Conversation
Running `npm test` could delete your Box CLI environments. After #731, some `login` and `logout` tests that never ran before started running. A few of them start the CLI with no environments set up. The CLI then saves an empty list of environments, and in tests that list went straight to your real system keychain, replacing whatever you had there. Other tests also wrote files into your real `~/.box` and `~/Downloads`. Tests now run in a sandbox. Before any test starts, `test/helpers/isolate-environment.js`: - gives the tests a temporary home folder instead of your real one, and empties it before each test; - swaps the system keychain for a simple in-memory one. Your real keychain and home folder are no longer touched. A few tests only passed because an earlier test had left a file or folder behind. They now set up what they need themselves.
Coverage Report for CI Build 43417052076Coverage decreased (-0.03%) to 87.022%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Running
npm testcould delete your Box CLI environments.After #731, some
loginandlogouttests that never ran before started running. A few of them start the CLI with no environments set up. The CLI then saves an empty list of environments, and in tests that list went straight to your real system keychain, replacing whatever you had there. Other tests also wrote files into your real~/.boxand~/Downloads.Tests now run in a sandbox. Before any test starts,
test/helpers/isolate-environment.js:Your real keychain and home folder are no longer touched.
A few tests only passed because an earlier test had left a file or folder behind. They now set up what they need themselves.