Search code examples
jenkinscontinuous-integrationvitest

Plain text reporter for Vitest


I am wondering if anyone has come up with a plain text reporter for vitest that works well with Jenkins CI and other displays that do not support colored text. It is virtually impossible to read in the Jenkins output or if I run the tests within Sublime Text as a build.


Solution

  • Solution

    You need to set the following environment - variable in the Jenkins - build:

    NO_COLOR = 'true'
    

    When you are using a Jenkinsfile, it looks like this:

    pipeline {
        agent any
        environment { 
            NO_COLOR = 'true'
        }
        stages {
            stage('test') {
                agent {
                    docker {
                        image 'node:16.17.0'
                        reuseNode true
                    }
                }
                environment {
                     HOME = '.'
                }
                steps {
                    sh 'npm install'
                    sh 'npm run jenkinsTest'
                }
            }
        }
    }
    

    Explanation


    Source

    https://github.com/vitest-dev/vitest/issues/841#issuecomment-1048997432