How to use xunit and nodejs

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

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

Everything is fine and I see this in my artifacts:
<img src="//" 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.
1 Like

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:

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:

That would make a great feature request

1 Like