Search code examples
testingcontinuous-integrationkarma-runnersaucelabs

Sauce Labs badge showing unknown karma.js


When including the Status Badge in a project's README.md file using:

[![Sauce Test Status](https://saucelabs.com/buildstatus/YOUR_SAUCE_USERNAME)](https://saucelabs.com/u/YOUR_SAUCE_USERNAME)

It is displaying this:

enter image description here

instead of this:

Sauce Labs Passing

Relevant devDependencies in the package.json file:

"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-jasmine": "^1.1.0",
"karma-sauce-launcher": "^1.1.0",

Relevant config settings in the karma.conf.js file:

singleRun: process.env.CI,
sauceLabs: {
  testName: 'Web App Tests'
},
customLaunchers: customLaunchers,
reporters: process.env.CI ? ['dots', 'saucelabs'] : ['progress']

Solution

  • I solved this by adding the build version to the karma.conf.js file:

    
        singleRun: process.env.CI,
        sauceLabs: {
          build: require('./package.json').version, // New
          testName: 'Web App Tests'
        },
        customLaunchers: customLaunchers,
        reporters: process.env.CI ? ['dots', 'saucelabs'] : ['progress']