【问题标题】:Code coverage in codecov.iocodecov.io 中的代码覆盖率
【发布时间】:2016-08-25 11:37:36
【问题描述】:

我在我的 package.json 文件中为 codegov.io 设置了 devdependies,并在同一个文件中为它制作了一个脚本。我将伊斯坦布尔用于代码覆盖本身。 此外,我还为它更新了我的 Travis.yml。 Travis 运行良好,构建和测试通过。 我在 Codecov 有一个用户帐户,但我似乎没有在 Codecov 中看到我的 git 存储库的任何覆盖率报告。

{
  "name": "canis-familiaris",
  "version": "0.0.0-semantically-released",
  "description": "Dog breeds",
  "main": "src/index.js",
  "scripts": {
    "commit": "git-cz",
    "check-coverage": "istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
    "report-coverage": "cat ./coverage/lcov.info | codecov",
    "test": "mocha src/index.test.js -w",
    "test-single": "istanbul cover -x *.test.js _mocha -- -R spec src/index.test.js",
    "semantic-release": "semantic-release pre && npm publish && semantic-release post"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mig-25/Canis-familiaris.git"
  },
  "keywords": [
    "Dogs",
    "Breed"
  ],
  "author": "Sohail Hasware <saab.viggen@live.se>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/mig-25/Canis-familiaris/issues"
  },
  "homepage": "https://github.com/mig-25/Canis-familiaris#readme",
  "dependencies": {
    "unique-random-array": "1.0.0"
  },
  "devDependencies": {
    "chai": "3.5.0",
    "codecov.io": "0.1.6",
    "commitizen": "2.8.6",
    "cz-conventional-changelog": "1.2.0",
    "ghooks": "1.3.2",
    "istanbul": "0.4.5",
    "mocha": "3.0.2",
    "semantic-release": "^4.3.5"
  },
  "czConfig": {
    "path": "node_modules/cz-conventional-changelog"
  },
  "config": {
    "ghooks": {
      "pre-commit": "npm run test-single && npm run check-coverage"
    }
  }
}

这是我的特拉维斯:

sudo: false
language: node_js
cache:
  directories:
    - node_modules
notifications:
  email: false
node_js:
  - 'iojs'
before_install:
  - npm i -g npm@^2.0.0
before_script:
  - npm prune
script:
  - npm run test-single
  - npm run check-coverage
after_success:
  - npm report-coverage
  - npm run semantic-release
branches:
  except:
    - /^v\d+\.\d+\.\d+$/

谁能告诉我这里缺少什么?

品种, 苏海尔

【问题讨论】:

  • 试试~npm report-coverage~npm run report-coverage谢谢!

标签: node.js code-coverage travis-ci package.json


【解决方案1】:

感谢您的提问。我相信您的 .travis.yml 中存在语法问题,导致覆盖范围无法执行。

- npm report-coverage + npm run report-coverage

Codecov 支持团队很乐意提供帮助。请通过https://codecov.io/support联系我们

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    • 2013-11-21
    • 2012-10-08
    • 2017-08-22
    相关资源
    最近更新 更多