From dedcf0fc00cae50990861fb0be95de9cd5034fae Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Thu, 24 Sep 2015 11:00:00 -0400 Subject: [PATCH] Document how to run the js unit tests --- js/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 js/README.md diff --git a/js/README.md b/js/README.md new file mode 100644 index 0000000000..1551055562 --- /dev/null +++ b/js/README.md @@ -0,0 +1,25 @@ +# NOMS JS + +This provides a library to read data from a NOMS server. + +## Requirements + +As usual, do `npm install`. + +## Testing + +We use [Mocha](https://mochajs.org/)/[Chai](http://chaijs.com/) for our JS unit tests. These currently only run in a browser so we use [Karma](https://karma-runner.github.io/). + +To start testing run: + +``` +npm run start-tests +``` + +This starts the Karma test server and launches a bunch of browser windows that connects to this server. Keep this process running as you work on your tests. The test runner detects changes in the test files and will rerun the tests when something changes and report the results in the same terminal. + +You can also manually run the tests and see the results in a terminal by doing `karma run`. To do this you first need to globally install karma by doing `npm install -g karma`. + +### Debugging in browser + +When you ran `npm run start-test` one or more browser windows should have opened. Find the the browser you care to test in. In the upper right of the status page there should be *Debug* button. Clicking that takes you to a page running your test. You can open dev tool there etc.