GitHub user filmaj opened a pull request:
https://github.com/apache/cordova-ios/pull/319
Updating unit tests + unit test runner and adding platformAPI addPlugin
unit tests
# Summary of Changes
- moved `jasmine.json` to `tests/spec`, next to all the unit tests.
eliminates the need to have an extra `spec/` dir at the top level.
- updated `package.json` scripts to use the new jasmine config file located
at `tests/spec/jasmine.json`. also updated code coverage command to run the
right thing.
- moved `bin/lib/check_reqs.js` and `bin/lib/versions.js` to the project
template, under `bin/templates/scripts/cordova/lib`, and had the commands that
are runnable globally (i.e. not from within a generated project) be able to
reference them. as such, had to update `create.js` to change the require paths
on the fly for these scripts. this, however, allows us to reference the build
js modules directly, opening them up to unit testing. note that [android uses
the same
technique](https://github.com/apache/cordova-android/blob/master/bin/lib/create.js#L153-L159),
and I think it is worth the tradeoff for eliminating try/catch around
requires, calling `require` only at runtime, and allowing these modules to be
unit tested.
- finally, added unit tests for platform API addPlugin method.
# Results
Worth noting that global code coverage dropped slightly, as reported by
instanbul, but I think that is mostly due to now `check_reqs.js` and
`versions.js` falling under the coverage 'umbrella' (and those scripts having
little-to-no coverage at all). However, `Api.js`' code coverage went from 35%
to 50%.
Please review @shazron.
FYI @stevengill @dpogue @kerrishotts @purplecabbage. Feel free to mention
anyone else who you think should review or be aware of these changes.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/filmaj/cordova-ios platform-api-unit-tests
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-ios/pull/319.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #319
----
commit d7949036979e051a9a1ab040ead6e51b64d3fdb1
Author: filmaj <[email protected]>
Date: 2017-06-13T20:56:12Z
Updating unit tests + unit test runner:\
- moved jasmine.json to tests/spec, next to all the unit tests. elimiantes
the need to have an extra spec/ dir at the top level.\
- updated package.json scripts to use the new jasmine config file. also
updated code coverage command to run the right thing.\
- moved bin/lib/check_reqs.js and bin/lib/versions.js to the project
template, and had the commands that are runnable globally (i.e. not from within
a generated project) be able to reference them. as such, had to update
create.js to change the require paths on the fly for these scripts. this,
however, allows us to reference the build js modules directly, opening them up
to unit testing.\
- finally, added unit tests for platform API addPlugin method.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]