DEV Community

Cover image for Publish Jest report in OneDev
Robin Shen
Robin Shen

Posted on • Updated on


Publish Jest report in OneDev

OneDev is an open source GitLab-like devops platform emphasizing easy-of-use. Jest is a popular javascript testing framework. This tutorial explains how to set up OneDev to publish Jest test report in a CI process.

Run OneDev

Run below command in your terminal on Linux/Mac to start OneDev:

$ docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/onedev:/opt/onedev -p 6610:6610 -p 6611:6611 1dev/server:4.3.3
Enter fullscreen mode Exit fullscreen mode

Then point your browser to http://localhost:6610 to set up OneDev following on-screen instructions.

Add a Demo Project

Now add a project in OneDev using Jest test framework, and push the code. For demonstration purpose, let’s use the react project.

  1. Create a project in OneDev with name react:

    Alt Text

  2. Push the code into newly created project:

    $ git clone
    $ cd react
    $ git push http://localhost:6610/react master:master 

Run Test and Publish Report

  1. Refresh the page after pushing code, and add build spec for the demo project like below:

    Alt Text

  2. Switch to Edit Source tab to use below source (do not worry about the build spec syntax, you may also use the GUI editor to set up necessary steps and triggers):

    version: 6
    - name: CI
      - !CheckoutStep
        name: checkout
        cloneCredential: !DefaultCredential {}
      - !CommandStep
        name: build
        image: node:10.16-alpine
        - export CI=true
        - 'yarn install '
        - yarn test --json --outputFile=testResults.json
      - !PublishJestTestReportStep
        name: publish test report
        reportName: Jest Test Report
        filePatterns: testResults.json
        condition: ALWAYS
      - !BranchUpdateTrigger {}
      retryCondition: never
      maxRetries: 3
      retryDelay: 30
      cpuRequirement: 250m
      memoryRequirement: 128m
      timeout: 3600

After build spec is committed, OneDev will run the job automatically. Note that Jest runs slowly on Docker on Mac. The build may take 30~60 minutes to complete. Visit the online demo page to see the report in action if you do not want to wait.

Access Jest Report

After build is finished, the Jest test report will be available in build detail page. Here we can filter tests by status and file path, view test trends by day, or jump to error position in file.

Alt Text

Oldest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.