From dc2534c9e0a0066c40ff90d8da11b2fb5bbd765b Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Fri, 28 Feb 2020 09:25:14 +0100 Subject: [PATCH] chore(ci): publish coverage (#5588) --- .github/workflows/test.yml | 8 +++++++- jest.config.js | 28 ++++++++++++++++++++++++++++ package.json | 33 --------------------------------- 3 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 jest.config.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71898105ff..1b603f8361 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,7 +126,13 @@ jobs: run: yarn build - name: Unit tests - run: yarn jest --maxWorkers=2 --ci --coverageReporters=text-summary + run: yarn jest --maxWorkers=2 --ci + + - name: Codecov + if: always() && matrix.os == 'ubuntu-latest' && matrix.node-version == 12 + run: bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload' + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: E2E Test run: yarn test-e2e diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000000..e2baca0bff --- /dev/null +++ b/jest.config.js @@ -0,0 +1,28 @@ +const ci = !!process.env.CI; + +module.exports = { + cacheDirectory: '.cache/jest', + coverageDirectory: './coverage', + collectCoverage: true, + collectCoverageFrom: [ + 'lib/**/*.{js,ts}', + '!lib/**/*.{d,spec}.ts', + '!lib/**/{__fixtures__,__mocks__}/**/*.{js,ts}', + ], + coverageReporters: ci + ? ['lcov', 'text-summary'] + : ['html', 'json', 'lcov', 'text-summary'], + coverageThreshold: { + global: { + branches: 95, + functions: 100, + lines: 100, + statements: 100, + }, + }, + setupFilesAfterEnv: ['<rootDir>/test/globals.ts'], + snapshotSerializers: ['<rootDir>/test/newline-snapshot-serializer.ts'], + transform: { + '^.+\\.(j|t)s$': 'babel-jest', + }, +}; diff --git a/package.json b/package.json index f68f8db5d7..385902fd71 100644 --- a/package.json +++ b/package.json @@ -246,39 +246,6 @@ "data", "dist" ], - "jest": { - "cacheDirectory": ".cache/jest", - "coverageDirectory": "./coverage", - "collectCoverage": true, - "collectCoverageFrom": [ - "lib/**/*.{js,ts}", - "!lib/**/*.{d,spec}.ts", - "!lib/**/{__fixtures__,__mocks__}/**/*.{js,ts}" - ], - "coverageReporters": [ - "html", - "json", - "lcov", - "text-summary" - ], - "coverageThreshold": { - "global": { - "branches": 95, - "functions": 100, - "lines": 100, - "statements": 100 - } - }, - "setupFilesAfterEnv": [ - "<rootDir>/test/globals.ts" - ], - "snapshotSerializers": [ - "<rootDir>/test/newline-snapshot-serializer.ts" - ], - "transform": { - "^.+\\.(j|t)s$": "babel-jest" - } - }, "publishConfig": { "tag": "latest" }, -- GitLab