瀏覽代碼

test: collect and publish code coverage

Jonas Gloning 2 年之前
父節點
當前提交
e1fd4dc476
共有 4 個文件被更改,包括 952 次插入15 次删除
  1. 7 2
      .github/workflows/node.js.yml
  2. 2 2
      .gitignore
  3. 941 11
      package-lock.json
  4. 2 0
      package.json

+ 7 - 2
.github/workflows/node.js.yml

@@ -27,5 +27,10 @@ jobs:
         node-version: ${{ matrix.node-version }}
         cache: 'npm'
     - run: npm ci
-    - run: npm run build --if-present
-    - run: npm test
+    - run: npm run build
+    - run: npm run lint
+    - run: npm run coverage
+    - name: Publish code coverage to CodeClimate
+      uses: paambaati/codeclimate-action@v3.2.0
+      env:
+         CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}

+ 2 - 2
.gitignore

@@ -1,4 +1,4 @@
-lib-cov
+.nyc_output
 *.seed
 *.log
 *.csv
@@ -17,4 +17,4 @@ npm-debug.log
 
 .idea
 .cache
-.vscode
+.vscode

File diff suppressed because it is too large
+ 941 - 11
package-lock.json


+ 2 - 0
package.json

@@ -34,6 +34,7 @@
     "tsc": "tsc",
     "prebuild": "npm run lint",
     "test": "npm run lint && mocha -r ts-node/register \"test/**/*\"",
+    "coverage": "nyc mocha -r ts-node/register \"test/**/*\"",
     "start": "bin/peerjs --port ${PORT:=9000}",
     "dev:start": "npm-run-all build start",
     "dev": "nodemon --watch src -e ts --exec npm run dev:start",
@@ -62,6 +63,7 @@
     "mock-socket": "8.0.5",
     "nodemon": "^2.0.20",
     "npm-run-all": "^4.1.5",
+    "nyc": "^15.1.0",
     "rimraf": "^3.0.2",
     "semantic-release": "^19.0.5",
     "sinon": "^7.5.0",

Some files were not shown because too many files changed in this diff