Generate Unit test reports for an Angular Project

I have an Angular project hosted on GitLab and I’m trying to generate Unit test reports via the CI Pipeline. I’m following this guide
There is no Angular example in the docs, that’s why I’m kindy stuck and don’t really know how to approach this task.

here is how my gitlab-ci.yml file looks like :

stage: test
image: trion/ng-cli-karma
allow_failure: false
- npm ci
- ng test --progress false --watch false
junit: report.xml
- docker

I have only 3 unit tests in my project. They pass successfully and the pipeline as well it doesn’t fail. However, I don’t get the desired result. Which is the test report.

here is how the log looks like :

Any help is appreciated :pray:t2:

Hi @Kalud999 thanks for posting!

I haven’t tried this myself but it looks like there is a converter that you can include in your project that will then help create the junit.xml formatted output that GitLab expects to show the report.

Good luck!

-James H, GitLab Product Manager, Verify:Testing

Hey @jheimbuck_gl ,

thanks for the suggestion, but I already did that actually. And it does work on my local machine. I run the ng test command in the Angular CLI and it does generates the unit test report for me in an .xml file.
But in the Pipeline , it’s a different story. Something is definitely missing to get this working

@Kalud999 if this is a project on I’d be happy to take a look if you can add me. Thanks!

-James H, GitLab Product Manager, Verify:Testing

1 Like

Thanks @jheimbuck_gl , that would be great :grinning:

here is the project I’m working on :

I got it !
All what was missing is specifying a folder for the xml file.
Now it works properly.
Thanks for your support anyway :slightly_smiling_face:

1 Like

That’s great to hear i’m glad it’s working!

1 Like

Hey James, I wanted to thank you again for your support the other day and also to ask you about the GitLab API . Is there a limit to how many http requests Im allowed to make in a day or maybe in an hour ? Because my API calls sometimes they go through without an issue, and other times they dont and get this “Too Many Requests” error …
what do you think ?

You can find information about rate limiting for self hosted and in the documentation.


1 Like