DEV Community

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

Posted on • Updated 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.

Oldest comments (0)


11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!