Closed txels closed 10 years ago
I think I'm being slow...but how do you get the coverage to work?
I ran fab develop
and then tox
and got coverage missing warnings.
Here's the output from running karam start --single-run
WARN [reporter]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [preprocess]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket KnlcNA67urpx9Ixl42fB
PhantomJS 1.9.7 (Mac OS X): Executed 6 of 6 SUCCESS (0.121 secs / 0.037 secs)
For the time being tox
does not install npm requirements within its virtual env and relies on global installs. Whereas fab develop
installs these in your local npm in the virtualenv. I have yet to update package.json for the travis build to work.
Check whether you are actually running the karma
binary in your virtualenv (apparently not, as you are running an older version than the one installed by fab develop
):
$ workon ployst # that's my virtualenv's name
$ which karma
/home/carles/.virtualenvs/ployst/bin/karma
$ karma start --single-run
WARN [karma]: Port 9876 in use
INFO [karma]: Karma v0.12.6 server started at http://localhost:9877/
Looks like the -g
in npm install screws with the upgrade. And unsurprisingly slow - it means install it globally - rather than in the VM!
Is it OK if we remove that -g
option?
(ployst)➜ ployst git:(carles/angular-tests) ✗ which karma
/Users/alex/.virtualenvs/ployst/bin/karma
(ployst)➜ ployst git:(carles/angular-tests) ✗ /Users/alex/.virtualenvs/ployst/bin/karma --version
Karma version: 0.10.10
(ployst)➜ ployst git:(carles/angular-tests) ✗ npm install -g karma@0.12.6
npm http GET https://registry.npmjs.org/karma/0.12.6
...
<Removed all the subsequent 304/GET requests>
...
npm http 304 https://registry.npmjs.org/options
(ployst)➜ ployst git:(carles/angular-tests) ✗ /Users/alex/.virtualenvs/ployst/bin/karma --version
Karma version: 0.10.10
Then, without the -g:
(ployst)➜ ployst git:(carles/angular-tests) ✗ /Users/alex/.virtualenvs/ployst/bin/karma --version
Karma version: 0.10.10
(ployst)➜ ployst git:(carles/angular-tests) ✗ npm install karma@0.12.6
npm http GET https://registry.npmjs.org/karma/0.12.6
...
<Removed all the subsequent 304/GET requests>
...
(ployst)➜ ployst git:(carles/angular-tests) ✗ /Users/alex/.virtualenvs/ployst/bin/karma --version
Karma version: 0.12.6
if you have run nodeenv -p
, which npm
should point to an npm version within your virtualenv. In that case, npm install -g
installs packages within your virtualenv, and ensures binaries are installed in your virtualenv's bin
.
npm install
without -g, on the contrary, will just download in your working directory's node_modules/
and won't care about ensuring scripts are in the path (bower, less, jshint, karma-cli... we rely on those commands being installed in the path, and some even complain if they are not npm WARN prefer global jshint@2.3.0 should be installed with -g
). So they end up in places like ./node_modules/karma-cli/bin/karma
. We could just not care and always do a local install and always use that relative path. I will try that. It goes together with https://github.com/pretenders/ployst/pull/51/files but includes a little more work.
(ployst)➜ ployst git:(alex/pre-commit) ✗ which npm
/Users/alex/.virtualenvs/ployst/bin/npm
I'm going to try and build the venv again from scratch.
I've simplified the whole npm dependency management process. Everything is now npm-native (dependencies only in package.json
) and relies on just npm install
. You don't even need nodeenv
now, just a decently up to date version of node
(0.10) and npm
(1.4) in your system. tox
and travis
are happy with the new setup. Builds are fast. fab develop
also is.
On the flip side, all scripts are also installed only locally (in node_modules
but not in the path - jshint
, bower
, less
...) so invoking them is more cumbersome (e.g. ./node_modules/karma-cli/bin/karma
).
Should we create some aliases?
Oh you beat me to it!
Ideally we'd ensure that we have node and npm available on your system and install if not available.
...more angular unit tests.
I've also added JS test coverage. Once tests are run (or they can be run continuously with
karma start
) an HTML coverage report is generated incoverage/
.