Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node/test: Add support to store code coverage #162

Open
ValorMorgan opened this issue Sep 27, 2022 · 0 comments
Open

node/test: Add support to store code coverage #162

ValorMorgan opened this issue Sep 27, 2022 · 0 comments

Comments

@ValorMorgan
Copy link

Describe Request:

Update node/test to add support for exporting the coverage results of ran tests. Currently tests can have their results stored via store_test_results which exposes the pass/fail statuses to CircleCI. But the coverage is lost and a second testing operation has to happen to generate the coverage. This means the tests must be ran twice: 1) to get the pass/fail via node/test, 2) to get coverage via something like yarn jest --coverage with store_artifacts.

Examples:

Current

version: 2.1

orbs:
  node: circleci/node@X.Y.Z

jobs:
  collect_covearge:
    executor: node/default
    steps:
      - checkout
      - run: yarn install --frozen-lockfile
      - run: yarn jest --coverage
      - store_artifacts:
          path: coverage

workflows:
  main:
    jobs:
      - node/install-packages:
          pkg-manager: yarn
      - node/test:
          requires:
            - node/install-packages
          pkg-manager: yarn
          test-results-for: jest
      - collect_coverage:
          requires:
            - node/test

Future

version: 2.1

orbs:
  node: circleci/node@X.Y.Z

workflows:
  main:
    jobs:
      - node/install-packages:
          pkg-manager: yarn
      - node/test:
          requires:
            - node/install-packages
          pkg-manager: yarn
          test-results-for: jest
+         store-coverage: true

Supporting Documentation Links:

Coverage guide: https://circleci.com/docs/code-coverage#javascript
store_test_results docs: https://circleci.com/docs/configuration-reference#storetestresults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant