https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/
Do we have similar instructions for JS/TS based project where jest is being used to run unit tests.
Hi @Simmi Mourya ,
Have you tried using jest-junit to generate the result in the supported locations?
Hi @Saxea _Flowie_ , thank you for your response. I am using jest-junit. This is my package.json
"scripts": {"test": "jest --coverage",},"jest": { "collectCoverage": true,"reporters": ["default", "jest-junit"],"coverageThreshold": {"global": {"lines": 95}},"collectCoverageFrom": ["**/*.(t|j)s"],"coverageDirectory": "../server/test-reports",}
And this is my unit-test step in bitbucket-pipelines.yaml
- step: &unit-testname: Run jest unit testcaches:- npmscript:- cd server- npm config list- npm ci- echo "Running Jest unit tests with coverage"- npm run testartifacts:- server/test-reports/**/*
1. The pipeline step generates the server/test-reports/**/* but I can't browse the test-reports directly from bitbucket UI, it only lets me download the zip of this artifact. Is there a way to view reports from bitbucket UI itself?
This is what the test-reports directory looks like.
test-reports % tree -L 3.├── clover.xml├── coverage-final.json├── lcov-report│ ├── base.css│ ├── block-navigation.js│ ├── bello│ │ ├── bello.service.ts.html│ │ ├── dto│ │ └── index.html│ ├── favicon.png│ ├── index.html│ ├── prettify.css│ ├── prettify.js│ ├── sort-arrow-sprite.png│ ├── sorter.js│ └── hello│ ├── dto│ ├── index.html│ ├── hello.controller.ts.html│ └── hello.service.ts.html└── lcov.info
2. npm run test also generates a junit.xml inside the server folder, I'm not quite sure how to interpret/use it.
There is an existing thread that gives you an idea of what is displayed when the report files are picked up.
https://community.atlassian.com/t5/Bitbucket-questions/Where-do-I-view-pipeline-test-reports/qaq-p/689754?lightbox-message-images-1085506=54889iA170F3102F5D63E3
Hope this helps.
It looks like you're new here. Sign in or register to get started.