Эх сурвалжийг харах

test: enable lcov reporter on ci

configure typescript coverage
Jonas Gloning 2 жил өмнө
parent
commit
e45a9afc86

+ 1 - 1
.github/workflows/node.js.yml

@@ -29,7 +29,7 @@ jobs:
     - run: npm ci
     - run: npm run build
     - run: npm run lint
-    - run: npm run coverage
+    - run: npm run coverage:lcov
     - name: Publish code coverage to CodeClimate
       uses: paambaati/codeclimate-action@v3.2.0
       env:

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 .nyc_output
+coverage
 *.seed
 *.log
 *.csv

+ 5 - 0
.mocharc.jsonc

@@ -0,0 +1,5 @@
+{
+	"$schema": "https://json.schemastore.org/mocharc",
+	"require": "source-map-support/register",
+	"require": "ts-node/register"
+}

+ 6 - 0
.nycrc

@@ -0,0 +1,6 @@
+{
+  "$schema": "https://json.schemastore.org/nycrc.json",
+  "extends": "@istanbuljs/nyc-config-typescript",
+  "all": true,
+  "include": ["src/**/*.ts"]
+}

+ 27 - 1
package-lock.json

@@ -18,6 +18,7 @@
         "peerjs": "bin/peerjs"
       },
       "devDependencies": {
+        "@istanbuljs/nyc-config-typescript": "^1.0.2",
         "@semantic-release/changelog": "^6.0.1",
         "@semantic-release/git": "^10.0.1",
         "@types/chai": "^4.2.11",
@@ -38,7 +39,8 @@
         "rimraf": "^3.0.2",
         "semantic-release": "^19.0.5",
         "sinon": "^7.5.0",
-        "ts-node": "^8.7.0",
+        "source-map-support": "^0.5.21",
+        "ts-node": "^8.10.2",
         "typescript": "^4.1.2"
       },
       "engines": {
@@ -499,6 +501,21 @@
         "node": ">=8"
       }
     },
+    "node_modules/@istanbuljs/nyc-config-typescript": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.2.tgz",
+      "integrity": "sha512-iKGIyMoyJuFnJRSVTZ78POIRvNnwZaWIf8vG4ZS3rQq58MMDrqEX2nnzx0R28V2X8JvmKYiqY9FP2hlJsm8A0w==",
+      "dev": true,
+      "dependencies": {
+        "@istanbuljs/schema": "^0.1.2"
+      },
+      "engines": {
+        "node": ">=8"
+      },
+      "peerDependencies": {
+        "nyc": ">=15"
+      }
+    },
     "node_modules/@istanbuljs/schema": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
@@ -11493,6 +11510,15 @@
         }
       }
     },
+    "@istanbuljs/nyc-config-typescript": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.2.tgz",
+      "integrity": "sha512-iKGIyMoyJuFnJRSVTZ78POIRvNnwZaWIf8vG4ZS3rQq58MMDrqEX2nnzx0R28V2X8JvmKYiqY9FP2hlJsm8A0w==",
+      "dev": true,
+      "requires": {
+        "@istanbuljs/schema": "^0.1.2"
+      }
+    },
     "@istanbuljs/schema": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",

+ 6 - 3
package.json

@@ -33,8 +33,9 @@
     "lint": "eslint --ext .js,.ts .",
     "tsc": "tsc",
     "prebuild": "npm run lint",
-    "test": "npm run lint && mocha -r ts-node/register \"test/**/*\"",
-    "coverage": "nyc mocha -r ts-node/register \"test/**/*\"",
+    "test": "npm run lint && mocha \"test/**/*\"",
+    "coverage": "nyc mocha \"test/**/*\"",
+    "coverage:lcov": "nyc --reporter=lcov mocha \"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",
@@ -47,6 +48,7 @@
     "yargs": "^15.3.1"
   },
   "devDependencies": {
+    "@istanbuljs/nyc-config-typescript": "^1.0.2",
     "@semantic-release/changelog": "^6.0.1",
     "@semantic-release/git": "^10.0.1",
     "@types/chai": "^4.2.11",
@@ -67,7 +69,8 @@
     "rimraf": "^3.0.2",
     "semantic-release": "^19.0.5",
     "sinon": "^7.5.0",
-    "ts-node": "^8.7.0",
+    "source-map-support": "^0.5.21",
+    "ts-node": "^8.10.2",
     "typescript": "^4.1.2"
   },
   "engines": {

+ 2 - 2
tsconfig.json

@@ -14,7 +14,7 @@
         "noUnusedParameters": true,
         "resolveJsonModule": true,
         "skipLibCheck": true,
-        "sourceMap": false,
+        "sourceMap": true,
         "outDir": "dist"
     },
     "include": [
@@ -24,4 +24,4 @@
         "test",
         "bin",
     ]
-}
+}