diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 469adac6..6e338415 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,14 @@ jobs: - uses: actions/setup-node@v2 with: - node-version: '16' + node-version: "16" - run: | npm clean-install npm run test + + - name: Upload coverage results to Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./test/coverage/lcov.info diff --git a/jest.config.js b/jest.config.js index 87c30aa4..5d800eeb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,14 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', + collectCoverage: true, + coverageDirectory: './test/coverage', + coverageReporters: ['json', 'html', 'lcov'], + collectCoverageFrom: [ + './src/**/*.{js,ts}', + './test/**/*.ts', + '!**/node_modules/**', + '!**/vendor/**', + '!**/vendor/**', + ], } diff --git a/package.json b/package.json index e440b5ab..ab56b8a7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "docs": "typedoc src/index.ts --out docs/v2", "docs:json": "typedoc --json docs/v2/spec.json --excludeExternals src/index.ts", "test": "run-s format:check test:types db:clean db:run test:run db:clean && node test/smoke.cjs && node test/smoke.mjs", - "test:run": "jest --runInBand", + "test:run": "jest --runInBand --coverage", "test:update": "run-s db:clean db:run && jest --runInBand --updateSnapshot && run-s db:clean", "test:types": "run-s build && tsd --files 'test/**/*.test-d.ts'", "db:clean": "cd test/db && docker compose down --volumes",