kwk / docker-registry-frontend

Browse and modify your Docker registry in a browser.
https://registry.hub.docker.com/u/konradkleine/docker-registry-frontend/
MIT License
1.68k stars 616 forks source link

How do I run unit tests? E.g.: Karma #139

Closed msabramo closed 8 years ago

msabramo commented 8 years ago

I'm wanting to do some development like fixing broken routes. It would be handy if I could add and run some unit tests. I tried npm test and got an error about an invalid Karma task. I think documenting how to run Karma (and Protractor) in the developer guide would be super useful for developers.

[marca@marca-mac2 docker-registry-frontend]$ pwd
/Users/marca/dev/git-repos/docker-registry-frontend

[marca@marca-mac2 docker-registry-frontend]$ npm test

> docker-registry-frontend@0.0.2 test /Users/marca/dev/git-repos/docker-registry-frontend
> grunt test

Warning: Task "karma" not found. Use --force to continue.

Aborted due to warnings.

Execution Time (2016-07-09 18:38:03 UTC)
loading tasks  29ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 97%
Total 30ms

npm ERR! Test failed.  See above for more details.

Also tried directly with grunt:

[marca@marca-mac2 docker-registry-frontend]$ grunt test
Warning: Task "karma" not found. Use --force to continue.

Aborted due to warnings.

Execution Time (2016-07-09 18:39:00 UTC)
loading tasks  18ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95%
Total 19ms

Also tried running it in the Docker development container:

[marca@marca-mac2 develop]$ docker run -v $(pwd)/../:/source -w /source -it --rm --name=docker-registry-frontend-develop -it develop_frontend npm test

> docker-registry-frontend@0.0.2 test /source
> grunt test

Warning: Task "karma" not found. Use --force to continue.

Aborted due to warnings.

Execution Time (2016-07-09 18:45:36 UTC)
loading tasks  210ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 211ms

npm ERR! weird error 3
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0