# Test summary not being displayed - issues with Mocha report

**URL:** <https://discuss.circleci.com/t/test-summary-not-being-displayed-issues-with-mocha-report/26401>\
**Category:** Running Tests\
**Created:** [November 8, 2018, 4:07pm UTC](https://discuss.circleci.com/t/test-summary-not-being-displayed-issues-with-mocha-report/26401 "2018-11-08T16:07:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kptdobe](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kptdobe/32/22052_2.png) [@kptdobe](https://discuss.circleci.com/u/kptdobe)\
**Post date:** [November 8, 2018, 4:07pm UTC](https://discuss.circleci.com/t/test-summary-not-being-displayed-issues-with-mocha-report/26401/1 "2018-11-08T16:07:04Z")

</div>

The example described in the doc [https://circleci.com/docs/2.0/collect-test-data/#mochajs](https://circleci.com/docs/2.0/collect-test-data/#mochajs) regarding the [mocha-junit-reporter](https://www.npmjs.com/package/mocha-junit-reporter) does not work if you have a global working directory which is not ~ (home directory).

This is expected because the defined `MOCHA_FILE: junit/test-results.xml` refers to your custom working directory and then not the `~/junit` folder which is in home (but then your logs are forced to be in your working directory).

The simplest solution is to change the code to (remove all the references to ~):

```auto
steps:
      - checkout
      - run: npm install
      - run: mkdir junit
      - run:
          command: mocha test --reporter mocha-junit-reporter
          environment:
            MOCHA_FILE: junit/test-results.xml
          when: always
      - store_test_results:
          path: junit
      - store_artifacts:
          path: junit

```

Another solution if you do want your logs in a specific place is to use full paths in all the instructions.

Things to know which I think should be documented somewhere and where I lost most of the time debugging:

- path in MOCHA\_FILE cannot be prefixed with another variable
- more tricky: MOCHA\_FILE variable does not resolve the ~ thus it would create a folder named ~ in your working directory  
In both cases, store\_test\_results / artifacts will naturally do nothing because folder is empty: logs are somewhere else!

Hope that the time lost to resolve this basic issue will help someone else! Maybe CircleCI team, you can save us a lot of time by improving this area, thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [February 6, 2019, 4:07pm UTC](https://discuss.circleci.com/t/test-summary-not-being-displayed-issues-with-mocha-report/26401/2 "2019-02-06T16:07:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
