codecov.io中的代码覆盖率

时间:2016-08-25 11:37:37

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

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

{
  "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+$/

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

Breds, 苏海尔

1 个答案:

答案 0 :(得分:0)

谢谢你的提问。我相信您的 <?php include('../ss_engine/config.php'); if(isset($_POST['submit'])) { $lessons[] = $_POST['lesson']; $lesson_string; foreach($lessons as $lesson) { $lesson_string=$lesson.'FLOAT NOT NULL ,'; } $sql='CREATE TABLE IF NOT EXISTS darsha( `id` INT NOT NULL AUTO_INCREMENT, `sid` INT(6) NOT NULL, `firstname` VARCHAR(255) NOT NULL, `lastname` VARCHAR(255) NOT NULL, `class` VARCHAR(255) NOT NULL,'. $lesson_string .' PRIMARY KEY ( `id` ) ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci'; $result = $conn->query($sql); if($result) { echo 'success'; } else { echo 'Error adding data'.$conn->error; } } ?> <!DOCTYPE HTML> <html> <head> <title>تعریف دروس</title> </head> <script> $('#addNew').click(function() { var rowCount = $('#myTable tr').length; $('#myTable tbody').append('<tr class="child"><td>lesson '+rowCount + '</td><td> <input type="text" name="lesson[]" /></td></tr>'); }); </script> <body> <form action="" method="POST"> <table style="border: 1px solid #454545;width: 100%;" id="myTable"> <tr> <td>lesson 1</td> <td><input type="text" name="lesson[]" /></td> </tr> <tr> <td>lesson 2</td> <td><input type="text" name="lesson[]" /></td> </tr> <tr> <td>lesson 3</td> <td><input type="text" name="lesson[]" /></td> </tr> <tr> <td>lesson 4</td> <td><input type="text" name="lesson[]" /></td> </tr> <tr> <td>lesson 5</td> <td><input type="text" name="lesson[]" /></td> </tr> <tr> <td><input type="submit" value="submut" name="submit" /></td> <td><button id="addNew">add new field</button></td> </tr> </table> </form> </body> </html> 存在语法问题,导致覆盖范围无法执行。

.travis.yml

Codecov支持团队很乐意为您提供帮助。请通过plunker link

与我们联系
相关问题