diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c219d93..2347e56 100644 --- a/.github/workflows/node.js.yml +++ b/.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: diff --git a/.gitignore b/.gitignore index ab178f2..df2e16b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .nyc_output +coverage *.seed *.log *.csv diff --git a/.mocharc.jsonc b/.mocharc.jsonc new file mode 100644 index 0000000..fb99657 --- /dev/null +++ b/.mocharc.jsonc @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/mocharc", + "require": "source-map-support/register", + "require": "ts-node/register" +} \ No newline at end of file diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000..44927be --- /dev/null +++ b/.nycrc @@ -0,0 +1,6 @@ +{ + "$schema": "https://json.schemastore.org/nycrc.json", + "extends": "@istanbuljs/nyc-config-typescript", + "all": true, + "include": ["src/**/*.ts"] +} diff --git a/package-lock.json b/package-lock.json index 672c349..f64ec42 100644 --- a/package-lock.json +++ b/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", diff --git a/package.json b/package.json index 16f91fb..778e191 100644 --- a/package.json +++ b/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": { diff --git a/tsconfig.json b/tsconfig.json index 3c7af7a..5621ad6 100644 --- a/tsconfig.json +++ b/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", ] -} \ No newline at end of file +}