-
Notifications
You must be signed in to change notification settings - Fork 15
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
Automated integration tests for parent-level commands #70
Automated integration tests for parent-level commands #70
Conversation
Codecov Report
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
+ Coverage 69.34% 73.52% +4.18%
==========================================
Files 13 16 +3
Lines 398 476 +78
Branches 66 74 +8
==========================================
+ Hits 276 350 +74
- Misses 101 105 +4
Partials 21 21
Continue to review full report at Codecov.
|
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.
Gave the suite a run and worked as expected 👍 Nice work!!!
While there is nothing functionally wrong, I do feel that the proposed shared test/spec for the help tests is significant enough of an impact on the code base, that it should be done before I accept. Heck, could you write a test that also just loops over 'commands.js' and runs help on them? This might automatically ensure new entries get that test? Food for thought on that one.
@@ -1,18 +1,22 @@ | |||
version: "~> 1.0" |
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.
Interesting, so to test the dotnet related commands, you are installing node on a dotnet/csharp node. This works for now, but does bring up the point that we could very well get into a scenario where we need to have multiple travis build environments as the CLI works with even other project types. No need to go down that road now of course.
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.
For sure. I wasn't sure if it would be better to manually install the dotnet dependencies in the script itself, or use the community dotnet template. I chose the path of less resistance for now 😛
I think that might be the way to go - it would definitely save our butts in the event that someone forgets to add the help test boilerplate (whether or not we abstract that out into a shared test/spec.) The test files for each command could then be more specific to the functionality of the command itself. |
…re appropriate, export options array from dotnetBuild to reference in parent command and tests
@wintondeshong I believe I have captured all of your feedback. The biggest refactor was the While I kept those |
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.
@brandongregoryscott totally dig the shared test helper. good to go after renaming of the _whenGivenOptions
shared test and removing the word when
in a few of the tests that state when given...
…s' to be more consistent with GWT convention
Issue #46
First pass at setting up integration tests for the parent-level commands to help prevent regressions at the level that connects module code together.
Summary of changes:
test-utils
file to hold test-specific functionality (spawning processes, creating tmp directories, verifying environment setup)shelljs
andchild_process
are mocked (actual jest mocks instead of function replacements, so the actual implementation can be restored if needed)-h
and--help
flags display the help menu for the command.cli.test.js
file also tests that every command in_modules/commands.js
is displayed in the help menucli-dotnet.test.js
file tests that running-b
or--build
without a dotnet solution below the current directory prints an error.cli-dotnet.test.js
file tests that a fresh solution with a console app project successfully builds.setupTests.js
totests/
subfolder, as well as adding a specific file for "setupAfterEnv" config setting for Jest.nvm
out of the box, so we can still target a specific node version and install dependencies by leveraging that.@wintondeshong This is a pretty hefty update to the project, so I would love to get some feedback from you on the infrastructure I setup for the test suite. No rush on this, but I agree with the increased need for test coverage at this level.