Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 1 | #### |
Simon Hunt | f306972 | 2014-12-16 18:15:37 -0800 | [diff] [blame] | 2 | # Unit and integration tests for code under the /app directory |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 3 | #### |
Simon Hunt | 420691a | 2014-12-16 20:16:28 -0800 | [diff] [blame] | 4 | |
| 5 | To run these tests, karma, node.js etc needs to be installed in the |
| 6 | build environment. |
| 7 | |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 8 | Once Node.js is installed from this folder execute: |
Simon Hunt | 420691a | 2014-12-16 20:16:28 -0800 | [diff] [blame] | 9 | |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 10 | $ npm install |
| 11 | |
| 12 | And then execute the following: |
| 13 | |
| 14 | $ npm test |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 15 | |
| 16 | This will launch and capture a browser, install and run the unit tests. |
| 17 | |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 18 | To re-run the tests every time a |
| 19 | file change is detected, (i.e. each time a source file is saved) use: |
| 20 | |
| 21 | $ npm run test:dev |
Simon Hunt | 51fc40b | 2015-01-06 13:56:12 -0800 | [diff] [blame] | 22 | |
| 23 | ---------------------------------------------------------------------- |
| 24 | Useful Notes |
| 25 | ============ |
| 26 | |
| 27 | Set a 'breakpoint' with the debugger command: |
| 28 | |
| 29 | it('should define four functions', function () { |
| 30 | debugger; |
| 31 | |
| 32 | expect(fs.isF(gs.init)).toBeTruthy(); |
| 33 | // ... |
| 34 | }); |
| 35 | |
| 36 | Open Developer Tools in the captured Chrome browser, and reload the page. |
| 37 | The debugger will break at the given point, allowing you to inspect context. |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 38 | |
| 39 | ---------------------------------------------------------------------- |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 40 | |