mozilla / firefox-code-coverage-frontend

The Firefox code coverage diff viewer allows determining code coverage changes for added lines per changeset.
https://firefox-code-coverage.herokuapp.com/
Mozilla Public License 2.0
9 stars 19 forks source link

Add some tests for the utils modules #132

Closed armenzg closed 6 years ago

armenzg commented 6 years ago

We've got some utils function in here that we could add some tests for.

armenzg commented 6 years ago

On the fx-health-backend, this entry allows for running tests:

"test:src": "nyc neutrino test",

and get code coverage [1].

The dependencies needed are:

On a follow up we can add coverals to hook up coveralls.io (e.g. https://coveralls.io/github/mozilla/firefox-health-backend). I don't recall the reason for mocha-lcov-reporter. It might be needed to make nyc work with mocha.

[1]

armenzg@armenzg-mbp backend$ yarn test:src
yarn run v1.5.1
$ nyc neutrino test
koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md src/app.js:1:8749

  parseVersion
    ✓ should parse valid formats

  /release
    GET /release/
      ✓ should return 200 (487ms)
    GET /release/chrome/
      ✓ should return 200 (2676ms)
    GET /release/latest/
No results for firefox/nightly, major: false
      ✓ should return 200 (1048ms)
    GET /release/history/
      ✓ should return 200
      ✓ should return 200 for beta
    GET /release/calendar/
      ✓ should return 200 (527ms)
    GET /release/updates/
      ✓ should return 200 (1423ms)

  /bz
    GET /regressions/missed/
      ✓ should return 200

  getInDevelopment
    ✓ should return an array (646ms)

  getChromePopular
    ✓ should return an array (8679ms)

  11 passing (16s)

----------------------|----------|----------|----------|----------|----------------|
File                  |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------------------|----------|----------|----------|----------|----------------|
All files             |    38.14 |    38.29 |    24.67 |    38.67 |                |
 backend              |      100 |      100 |      100 |      100 |                |
  .neutrinorc.js      |      100 |      100 |      100 |      100 |                |
 backend/src          |    24.84 |     5.08 |    11.54 |    26.25 |                |
  app.js              |    63.64 |        0 |        0 |    71.79 |... 54,55,57,58 |
  bz.js               |    18.33 |        0 |    11.76 |    19.23 |... 89,91,94,96 |
  crashes.js          |    17.07 |        0 |        0 |    19.18 |... 154,155,158 |
  perf.js             |    11.55 |        0 |        0 |    13.18 |... 374,375,376 |
  release.js          |      100 |      100 |      100 |      100 |                |
  status.js           |    38.46 |      100 |        0 |    45.45 |... 11,14,15,16 |
 backend/src/bz       |     97.3 |    91.67 |      100 |    97.06 |                |
  release.js          |     97.3 |    91.67 |      100 |    97.06 |             14 |
 backend/src/fetch    |    73.08 |    59.26 |    88.89 |    71.11 |                |
  html.js             |     87.5 |       75 |      100 |    85.71 |              8 |
  json.js             |    85.71 |       50 |      100 |    83.33 |              6 |
  redash.js           |       25 |        0 |        0 |       25 |    4,5,6,7,8,9 |
  text.js             |    79.31 |    66.67 |      100 |    79.17 | 16,19,28,32,33 |
 backend/src/meta     |    98.48 |    96.08 |      100 |    98.48 |                |
  feature.js          |    97.73 |    90.91 |      100 |    97.73 |             91 |
  version.js          |      100 |      100 |      100 |      100 |                |
 backend/src/perf     |    10.79 |        0 |     2.38 |    11.26 |                |
  speedometer.js      |    22.81 |        0 |     6.67 |    23.64 |... 121,123,129 |
  telemetry-node.js   |     7.67 |        0 |     2.63 |     7.69 |... 597,598,599 |
  telemetry_config.js |      100 |      100 |      100 |      100 |                |
  tmo-wrapper.js      |    15.79 |        0 |        0 |    18.75 |... 107,109,114 |
  tmo.js              |     9.76 |        0 |        0 |    12.12 |... 65,66,67,68 |
 backend/src/release  |    90.24 |     69.7 |    93.33 |    90.83 |                |
  calendar.js         |       96 |    85.71 |      100 |    95.65 |             23 |
  chrome.js           |    95.83 |    66.67 |      100 |    95.24 |             18 |
  history.js          |    78.72 |       60 |    85.71 |    80.95 |... 71,81,82,83 |
  updates.js          |      100 |       80 |      100 |      100 |           6,24 |
  versions.js         |      100 |      100 |      100 |      100 |                |
 backend/src/status   |    96.59 |     93.1 |      100 |    96.34 |                |
  caniuse.js          |      100 |      100 |      100 |      100 |                |
  chrome.js           |    94.83 |     91.3 |      100 |    94.34 |       54,55,56 |
----------------------|----------|----------|----------|----------|----------------|
✨  Done in 28.34s.
armenzg commented 6 years ago

Let's say this is done.