No Test Summary

nodejs

#1

Hi, I have the same problem the posts below have described: I set up a .circleci/config.yml (see https://circleci.com/gh/michael-brade/LaTeX.js/12#config/containers/0), added the store_test_results, artifacts are uploaded properly – and yet, the webgui in the tab “Test Summary” claims I need to setup tests. I don’t know how, and I don’t understand the answers in those posts:


How and where do I define $CIRCLE_TEST_REPORTS? I found no examples or documentation. The second thread actually claims that it should work without setting the variable.

Any ideas?


#2

Are you using the junit reporter as shown in this example: https://circleci.com/docs/2.0/collect-test-data/#mocha-for-nodejs


#3

Yes, I am. This is the config from package.json:

    "testc": "nyc ./node_modules/.bin/mocha --reporter mocha-junit-reporter --reporter-options mochaFile=./test/test-results.xml test/*.ls;",
    "cover": "nyc report --reporter=html --reporter=text --reporter=lcovonly --report-dir=test/coverage;"

And in config.yml:

     - run:
          name: Run unit tests
          command: npm run testc
      - run:
          name: Generate code coverage
          command: npm run cover
          when: always

      - store_artifacts:
          path: test/test-results.xml
          prefix: tests
      - store_artifacts:
          path: test/coverage
          prefix: coverage
      - store_test_results:
          path: test/test-results.xml
          prefix: tests

Do I have to upload the whole test folder? Or should the test-results.xml be enough?


#4

This is no longer required in 2.0

I think this may be your issue. Per the doc it expects a path instead of a file. Could you try removing the file and see if that resolves the issue?

      - store_test_results:
          path: test

That should do it.


#5

Yes indeed! Thank you very much! :slight_smile:


#6

My pleasure! Glad this is working now.


#7

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