diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71898105ff4bd8331708ffe785a97cf52760e204..1b603f83616ab62de63c3ee0dcbb428fb26a9105 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 0000000000000000000000000000000000000000..e2baca0bfff72c5a2078ddb07ce965b06473f89f --- /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 f68f8db5d7ce255a00fbac3392825c33f272b0f4..385902fd7137830350b93c7ccdf5a5fb042ea47b 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" },