From 913518dcb39bfd8f7fff3b0dbe63737dab67c06f Mon Sep 17 00:00:00 2001 From: Keisuke Umeno <9renpoto@gmail.com> Date: Sat, 11 Nov 2023 11:26:48 +0900 Subject: [PATCH 1/2] feat: coveralls to codecov --- .github/renovate.json | 4 +-- .github/stale.yml | 12 ------- .github/workflows/actionlint.yml | 2 +- .github/workflows/bump.yml | 2 +- .github/workflows/nodejs.yml | 9 +++--- .github/workflows/npm-publish-packages.yml | 8 ++--- package-lock.json | 31 ++++++++++++++++--- package.json | 1 + .../src/firebase.module.spec.ts | 14 ++++++--- packages/nestjs-firebase/tsconfig.json | 22 ++----------- packages/nestjs-graphql-relay/tsconfig.json | 22 ++----------- packages/nestjs-slack-webhook/tsconfig.json | 22 ++----------- packages/nestjs-zendesk/tsconfig.json | 3 +- 13 files changed, 57 insertions(+), 95 deletions(-) delete mode 100644 .github/stale.yml diff --git a/.github/renovate.json b/.github/renovate.json index 226ad775..62292ef2 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,6 +1,6 @@ { - "automerge": true, + "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:base"], "labels": ["Type: Maintenance"], - "semanticCommits": true + "automerge": true } diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index cb50c1c7..00000000 --- a/.github/stale.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 1cbfa458..875a07e5 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -14,7 +14,7 @@ jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@v4 - uses: reviewdog/action-actionlint@v1 with: reporter: github-pr-review diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 1c0ba2cf..1147b0b0 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -61,7 +61,7 @@ jobs: - run: rm new - name: Create Pull Request - uses: peter-evans/create-pull-request@v5.0.2 + uses: peter-evans/create-pull-request@v5 with: base: ${{ github.ref }} branch: release-${{ github.ref_name }}-${{ steps.get_version.outputs.NEW_VERSION }} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 1d4c1937..4abfbc12 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,9 +11,9 @@ jobs: node-version: [lts/*, latest] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4.0.0 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm ci @@ -23,6 +23,5 @@ jobs: env: SLACK_WEBHOOK_URL: https://example.com CI: true - - uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3 - with: - github-token: ${{ secrets.github_token }} + - name: Codecov + uses: codecov/codecov-action@v3 diff --git a/.github/workflows/npm-publish-packages.yml b/.github/workflows/npm-publish-packages.yml index 9e5e9d06..144836a4 100644 --- a/.github/workflows/npm-publish-packages.yml +++ b/.github/workflows/npm-publish-packages.yml @@ -11,8 +11,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@v4.0.0 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: lts/* - run: npm ci @@ -25,8 +25,8 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@v4.0.0 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: lts/* registry-url: "https://registry.npmjs.org" diff --git a/package-lock.json b/package-lock.json index d103d962..ba1e54f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@nestjs/testing": "^10.0.0", "@types/jest": "^29.5.2", "husky": "^8.0.3", + "jest-mock-extended": "^3.0.5", "lint-staged": "^15.0.0", "ts-jest": "^29.1.0" }, @@ -3791,9 +3792,9 @@ } }, "node_modules/axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "peer": true, "dependencies": { "follow-redirects": "^1.15.0", @@ -8223,6 +8224,19 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-mock-extended": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/jest-mock-extended/-/jest-mock-extended-3.0.5.tgz", + "integrity": "sha512-/eHdaNPUAXe7f65gHH5urc8SbRVWjYxBqmCgax2uqOBJy8UUcCBMN1upj1eZ8y/i+IqpyEm4Kq0VKss/GCCTdw==", + "dev": true, + "dependencies": { + "ts-essentials": "^7.0.3" + }, + "peerDependencies": { + "jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0", + "typescript": "^3.0.0 || ^4.0.0 || ^5.0.0" + } + }, "node_modules/jest-pnp-resolver": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", @@ -12523,6 +12537,15 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-essentials": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "dev": true, + "peerDependencies": { + "typescript": ">=3.7.0" + } + }, "node_modules/ts-graphviz": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/ts-graphviz/-/ts-graphviz-1.8.1.tgz", @@ -13651,7 +13674,7 @@ "license": "MIT", "devDependencies": { "@google-cloud/firestore": "^7.0.0", - "@google-cloud/storage": "^7.6.0" + "@google-cloud/storage": "^7.0.0" }, "peerDependencies": { "@nestjs/common": "^10.0.0", diff --git a/package.json b/package.json index 1c665c65..ab4e68b3 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@nestjs/testing": "^10.0.0", "@types/jest": "^29.5.2", "husky": "^8.0.3", + "jest-mock-extended": "^3.0.5", "lint-staged": "^15.0.0", "ts-jest": "^29.1.0" }, diff --git a/packages/nestjs-firebase/src/firebase.module.spec.ts b/packages/nestjs-firebase/src/firebase.module.spec.ts index e31064ee..617a510f 100644 --- a/packages/nestjs-firebase/src/firebase.module.spec.ts +++ b/packages/nestjs-firebase/src/firebase.module.spec.ts @@ -6,13 +6,17 @@ import { FirebaseModuleOptionsFactory, } from "./firebase.interface"; import { FirebaseModule } from "./firebase.module"; -import * as utils from "./util"; - -jest.mock("./util"); -jest.spyOn(utils, "getFirebaseAdmin").mockReturnValue({} as any); +import * as admin from "firebase-admin"; +import * as path from "path"; +import { mock } from "jest-mock-extended"; describe("FirebaseModule", () => { - const googleApplicationCredential = "test"; + jest.spyOn(admin, "initializeApp").mockReturnValue(mock()); + + const googleApplicationCredential = path.join( + __dirname, + "../../../dummy.firebase.amin.key.json", + ); class TestService implements FirebaseModuleOptionsFactory { createFirebaseModuleOptions(): FirebaseModuleOptions { return { diff --git a/packages/nestjs-firebase/tsconfig.json b/packages/nestjs-firebase/tsconfig.json index 2d17fa7b..03d149de 100644 --- a/packages/nestjs-firebase/tsconfig.json +++ b/packages/nestjs-firebase/tsconfig.json @@ -1,26 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, - "baseUrl": "./", - "declaration": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "commonjs", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, "outDir": "./lib", - "removeComments": true, - "sourceMap": true, - "strict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": false, - "target": "ES2017" + "noEmit": false }, "exclude": ["node_modules", "**/*.spec.ts", "dist"], "include": ["src"] diff --git a/packages/nestjs-graphql-relay/tsconfig.json b/packages/nestjs-graphql-relay/tsconfig.json index 69a6f52a..4f20b7e6 100644 --- a/packages/nestjs-graphql-relay/tsconfig.json +++ b/packages/nestjs-graphql-relay/tsconfig.json @@ -1,26 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, - "baseUrl": "./", - "declaration": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "commonjs", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, "outDir": "./lib", - "removeComments": true, - "sourceMap": true, - "strict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": false, - "target": "ES2017" + "noEmit": false }, "exclude": ["node_modules", "dist"], "include": ["src"] diff --git a/packages/nestjs-slack-webhook/tsconfig.json b/packages/nestjs-slack-webhook/tsconfig.json index 69a6f52a..4f20b7e6 100644 --- a/packages/nestjs-slack-webhook/tsconfig.json +++ b/packages/nestjs-slack-webhook/tsconfig.json @@ -1,26 +1,8 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, - "baseUrl": "./", - "declaration": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "commonjs", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, "outDir": "./lib", - "removeComments": true, - "sourceMap": true, - "strict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": false, - "target": "ES2017" + "noEmit": false }, "exclude": ["node_modules", "dist"], "include": ["src"] diff --git a/packages/nestjs-zendesk/tsconfig.json b/packages/nestjs-zendesk/tsconfig.json index 3dcb2507..060fc839 100644 --- a/packages/nestjs-zendesk/tsconfig.json +++ b/packages/nestjs-zendesk/tsconfig.json @@ -3,5 +3,6 @@ "compilerOptions": { "outDir": "./lib", "noEmit": false - } + }, + "include": ["src"] } From fe2730a89c2fcedef644e3cda47a1628e79960c1 Mon Sep 17 00:00:00 2001 From: Keisuke Umeno <9renpoto@gmail.com> Date: Sat, 11 Nov 2023 11:31:43 +0900 Subject: [PATCH 2/2] docs: convert coverage badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index bb2f37d0..c1fd41b4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # nestjs-plugins ![Actions Status](https://github.com/g59/nestjs-plugins/workflows/Node%20CI/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/g59/nestjs-plugins/badge.svg?branch=main)](https://coveralls.io/github/g59/nestjs-plugins?branch=main) -[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +[![codecov](https://codecov.io/gh/g59/nestjs-plugins/graph/badge.svg?token=KVABG274X8)](https://codecov.io/gh/g59/nestjs-plugins) ## Install