-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Labels
installing nodeIssues with installing node/io.js versions.Issues with installing node/io.js versions.pull request wantedThis is a great way to contribute! Help us out :-DThis is a great way to contribute! Help us out :-DtestingStuff related to testing nvm itself.Stuff related to testing nvm itself.
Description
I was thinking about @ljharb's comment about the install script being untested, and had a look at how we could test it.
The testing tools that seem of interest to me are Roundup, shunt and the classic shunit2. Feedback about this list is more than welcome, I don't have much experience in unit-testing shell scripts.
The strategy is currently as follows:
- rewrite the script so we have smaller and more dedicated functions
- those smaller functions would be tested against their return code
- external tools would be mocked using aliases, for example
curl_mock_success() {
exit 0
}
curl_mock_failure() {
exit 1
}
alias curl=curl_mock_success #or curl_mock_failure, depending on the testsetUpandtearDownwould create/reset mocks as needed (if tests are not sandboxed)- function calls would be tested as external tools, with mocking. This is helpful to test the flow.
This is certainly not perfect and there is probably more to do than the described above, but I'm willing to give it a try and wanted to have your opinion on this firsthand.
Metadata
Metadata
Assignees
Labels
installing nodeIssues with installing node/io.js versions.Issues with installing node/io.js versions.pull request wantedThis is a great way to contribute! Help us out :-DThis is a great way to contribute! Help us out :-DtestingStuff related to testing nvm itself.Stuff related to testing nvm itself.