酱实验室徽章显示未知的karma.js

时间:2017-06-12 20:55:32

标签: testing continuous-integration karma-runner saucelabs

使用以下内容将Status Badge包含在项目的README.md文件中时

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

它显示了这个:

enter image description here

而不是:

Sauce Labs Passing

devDependencies文件中的相关package.json

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

karma.conf.js文件中的相关配置设置:

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

1 个答案:

答案 0 :(得分:0)

我通过构建版本添加到karma.conf.js文件中解决了这个问题:


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