Test summary not being displayed


#1

I have tried to match the guidelines found here CircleCI 2.0 Store Test Results but despite everything appearing in the artefacts folder the test summary is still telling me to set it up.

I’ve been banging my head on this for days and cannot make any progress can you assist?

My config file is very simple:

version: 2
machine:
  environment:
      MOCHA_FILE: "$CIRCLE_TEST_REPORTS/test-results/mocha/results.xml"

jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:7.10

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mongo:3.4.4

    working_directory: ~/stjude_hub_server

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install
      - run: mkdir ~/mocha
      - run: npm run compile

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run:
          command: 'node_modules/.bin/mocha --reporter mocha-junit-reporter --require babel-core/register --reporter-options mochaFile=~/test-results/mocha/results.xml src/**/**.spec.js'
      - store_test_results:
          path: ~/test-results/mocha/results.xml
      - store_artifacts:
          path: ~/test-results/mocha/results.xml

No Test Summary
#2

Go into your failed build and click the Configuration tab. Does your config file appear in there? I am presently thinking you have named either the folder or the filename wrongly.


#3

Hi,

Thanks for the reply; I checked the config in the failed build as you suggested and it looks identical. Below is a cut’n’paste directly from the failed build configuration section:

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
machine:
  environment:
      MOCHA_FILE: "$CIRCLE_TEST_REPORTS/test-results/mocha/results.xml"

jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:7.10

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mongo:3.4.4

    working_directory: ~/stjude_hub_server

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install
      - run: mkdir ~/mocha
      - run: npm run compile

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run:
          command: 'node_modules/.bin/mocha --reporter mocha-junit-reporter --require babel-core/register --reporter-options mochaFile=~/test-results/mocha/results.xml src/**/**.spec.js'
      - store_test_results:
          path: ~/test-results/mocha/results.xml
      - store_artifacts:
          path: ~/test-results/mocha/results.xml

And here is the artifacts section just for completeness:
Container 0
home/
circleci/
test-results/
mocha/
results.xml


#4

Hmm, odd. The next thing I’d try is to run your YAML through a validator - I tried your file on this one and it seems OK, but perhaps paste from your editor rather than the forum, in case this one is inadvertently fixed. Stray tabs and an incorrect number of spaces can all upset YAML.

Would you put a screenshot of that here? Perhaps there is a clue that can be seen from the screenshot.

You could also try my demo repo just to see if you have an account-wide fault.


#5

Hi Halfer,

Okay so I cloned and ran your repo which came up with the same message:

(I will do a second post with my repo)

Most odd.

Chris.


#6

And here is a screen shot of my last attempt with my repo (I’ve tried to show it telling me the test results are saved):


#7

Oh, sorry, I think I have been talking at cross-purposes. I was assuming your whole config was not being read, and you were getting no config read or output at all. I need to read the actual words on the screen :smile:.

It looks like your “Upload test results” section was successful. Do you get anything in your Artefacts tab?


#8

RE: Reading the words - hehehe; i’m in no position to point fingers in that regard. I’ve done that twice today already :slight_smile:
RE: Artefacts - yup, uploaded and I have looked at the results too. I’m not overly familiar with the JUNIT format but the XML contains all my tests and the expected results. There is definitively something in there.

I guess the only thing that it could be is that circleci cannot parse the XML for some reason but I am using the suggested reporter.


#9

$MOCHA_FILE is not being defined how you want it to. You can’t define an environment variable in 2.0 with the same syntax as 1.0. Additionally, you (unfortunately) can’t define an environment variable with other environment variables.

And the last thing is $CIRCLE_TEST_REPORTS is not defined in 2.0 - you’d need to define it yourself.


#10

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