Add test summary section to the job section sidebar
What does this MR do and why?
Add the test summary section to the job section sidebar.
The test summary section displays failures or total count depending on whether the job failed or not
#404654 (closed) and possibly #429727 (closed)
Screenshots or screen recordings
How to set up and validate locally
- Create a project that uses JUnit test reports; here are a few files you can use to create that project
.gitlab-ci.yml
javascript:
image: node:latest
stage: test
before_script:
- 'yarn global add jest'
- 'yarn add --dev jest-junit'
script:
- 'jest --ci --reporters=default --reporters=jest-junit --passWithNoTests'
artifacts:
when: always
reports:
junit:
- junit.xml
jest.config.js
const config = {
transform: {
'^.+\\.js$': 'babel-jest',
},
}
module.exports = config;
sum.js
function sum(a, b) {
return a + b;
}
module.exports = sum;
sum.test.js
const sum = require('./sum');
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
- Create a pipeline and wait for it to finish
- Look at the sidebar and the test summary should display
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jose Ivan Vargas