How to use xunit and nodejs

nodejs
circle.yml

#1

So I saw xunit support in the documentation and tried it as it says.
This is my circle.yml:

  override:
    - npm run test_junit:
        environment:
          MOCHA_FILE: $CIRCLE_TEST_REPORTS/junit/test-results.xml```

Everything is fine and I see this in my artifacts:
<img src="//circleci-discourse.s3.amazonaws.com/original/2X/7/7d41b768f94a3ef8cd3e42798101551b35f09175.png" width="602" height="138">

So I have two questions:
1- Why there is `$CIRCLE_TEST_REPORTS` there instead of `junit` or `testreports`? Did I do something wrong?
2- Is it what should happened after running the reporter? It puts a xml file in `artifacts`?

Thought this might help myself and others to understand this feature.

#2

Nope, that’s exactly right. It’s displayed as a tree, so $CIRCLE_TEST_REPORTS/junit/test-results.xml

The test-results.xml file is what the Mocha JUnit test runner outputs, and you told it to place it in $CIRCLE_TEST_REPORTS/junit/

We copy it to artifacts, because some users want to see te raw file, as well as the parsed results.

P.S. Our docs are open source, so we welcome pull requests if you think they can be clearer :slight_smile:


#3

Cool, tnx. I also found that the Test Summary has some texts and describes what happened. I hope you guys add some fancy charts there besides the text :wink:


#4

That would make a great feature request https://discuss.circleci.com/c/feature-requests


#5