DEV Community

Cover image for Annotate source with Jest/ESLint information in OneDev
Robin Shen
Robin Shen

Posted on • Edited on

Annotate source with Jest/ESLint information in OneDev

OneDev is an open source self-hosted DevOps platform, with ability to manage your git repositories, as well as running CI/CD jobs in docker containers.

The recent version can leverage your projects’s Jest/ESLint integration to:

  1. Generate report with ability to search/order by relevant metrics
  2. Annotate source code with Jest coverage and ESLint violations when view files or pull request changes
  3. Generate statistics of relevant metrics over time

To help you getting an instant impression of how it works, I cloned the react project, and add a demo branch to introduce some ESLint violations. CI job on this branch will generate three reports, respectively Jest test report, Jest coverage report and ESLint violations report. Also visit this file and this pull request to see source/diff annotated with Jest coverages and ESLint violations in action:

Alt Text

With this information, you will get extra confidence when merge the pull request.

Now let’s check build spec of the demo project to see how to achieve this:

  1. Commands of the test step runs Jest and ESLint to generate relevant reports
  2. Publish reports generated above via corresponding report publishing steps
  3. In Params & Triggers section, add triggers to run current job automatically upon branch updating and pull request creating

That’s it. Thanks for reading.

Top comments (0)