diff --git a/.github/workflows/postgres-redis-ci.yml b/.github/workflows/postgres-redis-ci.yml index 44500f8..6bf05b0 100644 --- a/.github/workflows/postgres-redis-ci.yml +++ b/.github/workflows/postgres-redis-ci.yml @@ -26,4 +26,6 @@ jobs: env: TEST_POSTGRES: true timeout-minutes: 5 - run: npm test \ No newline at end of file + run: npx nyc --silent npm test + - name: Generate coverage report + run: npm run cover:report \ No newline at end of file diff --git a/.nycrc.json b/.nycrc.json index 76027a5..af6eab0 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,5 +1,10 @@ { + "extends": "@istanbuljs/nyc-config-typescript", + "check-coverage": false, "exclude": [ - "src/routes/addUnlitedVideo.ts" - ] + "src/routes/addUnlistedVideo.ts", + "src/cronjob/downvoteSegmentArchiveJob.ts", + "src/databases/*" + ], + "reporter": ["text", "html"] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1656aa3..a03b338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "sync-mysql": "^3.0.1" }, "devDependencies": { + "@istanbuljs/nyc-config-typescript": "^1.0.2", "@types/better-sqlite3": "^7.5.0", "@types/cron": "^2.0.0", "@types/express": "^4.17.13", @@ -632,6 +633,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", @@ -6207,6 +6223,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 0f505b0..1c8077c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "src/index.ts", "scripts": { "test": "npm run tsc && ts-node test/test.ts", - "test:coverage": "nyc npm run test", + "cover": "nyc npm test", + "cover:report": "nyc report", "dev": "nodemon", "dev:bash": "nodemon -x 'npm test ; npm start'", "postgres:docker": "docker run --rm -p 5432:5432 -e POSTGRES_USER=ci_db_user -e POSTGRES_PASSWORD=ci_db_pass postgres:alpine", @@ -32,6 +33,7 @@ "sync-mysql": "^3.0.1" }, "devDependencies": { + "@istanbuljs/nyc-config-typescript": "^1.0.2", "@types/better-sqlite3": "^7.5.0", "@types/cron": "^2.0.0", "@types/express": "^4.17.13",