Reorganized unit test directory structure + updated npm task names #568
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.
What does this PR do?
This is a proof-of-concept pull request mainly introduction file organizational changes. Please treat this PR as a discussion point, not as something that needs to be mergeable right away. I wanted to get the feedback of the community and PMC on this change before I went ahead with anything.
Ping @purplecabbage, @stevengill, @shazron, @mwbrooks, @devgeeks, @surajpindoria, @imhotep, @dpogue, @kerrishotts, @matrosov-nikita, @goya, @jcesarmobile, @macdonst, @infil00p. If I missed anyone, please pull them in too ;)
The single biggest change, and takeaway, from this PR is that the unit tests under
spec-cordova/
andspec-plugman/
are consolidated into a single top-levelspec/
directory. The idea behind this change (and hopefully future to come changes) is that there will exist one unit test spec file per javascript source file as a rough rule-of-thumb. Further, the test directory structure should mirror, as closely as possible, the source directory structure. I feel that that is an implied expectation when it comes to unit test file structures. I think possibly one reason why so many integration tests exist in this repository is that that structure right now is not honoured. So, when contributions come in, the typical expectation of "I made a change in src/foo.js, but I don't see a unit test file under spec/foo.spec.js" is broken, and people feel they have to write integration tests to get the kind of test coverage their contribution requires. Hopefully we can break that pattern here and continue to march towards a healthier and faster test suite.Other than the directory changes, a summary of smaller but also relevant changes:
spec/
directory:helper.js
,helpers.js
andcommon.js
. Combining those into one test-helper file is left as an exercise for a future pull request :)package.json
npm run
tasks to better reflect the purpose of the task. In particular, changednpm run jasmine
tonpm run unit-tests
. I also thought of changing thejshint
task to belinter
, but then decided against it. I am open to hearing opinions on this.npm test
runs the integration tests as well. They currently take around 400 seconds to run on my machine, but without them right now we cannot guarantee we will have regressions. I am hoping that as we rewrite more and more integration tests into smaller, faster, more focussed unit tests, the integration test times will continue to drop.npm
task names, and also fixed the link to the issue tracker :)What testing has been done on this change?
npm test
.