feat: fix code coverage workflow (#195)

* feat: create a dummy component for testing coverage workflow

* feat: add test for dummy component

* fix: delta

* fix: command

* fix: remove test file regexp

* chore: break tests

* fix: tests

* feat: add test for footer component

* fix: delete dummy component
This commit is contained in:
Yusuf Seyrek 2023-05-12 10:55:51 +03:00 committed by GitHub
parent e555c69e07
commit a59e880559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -20,10 +20,5 @@ jobs:
uses: anuraag016/Jest-Coverage-Diff@master
with:
fullCoverageDiff: false
runCommand: 'yarn jest --collectCoverageFrom=''["src/**/*.{js,jsx,ts,tsx}"]'' --coverage --collectCoverage=true --coverageDirectory=''./'' --coverageReporters=''json-summary'' --forceExit --detectOpenHandles __tests__/**/*.test.*'
runCommand: "yarn jest --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles"
delta: 0.5
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: coverage/lcov.info

2
.gitignore vendored
View File

@ -7,7 +7,7 @@
# testing
/coverage
.coverage-summary.json
coverage-summary.json
# next.js
/.next/

14
__tests__/Footer.test.tsx Normal file
View File

@ -0,0 +1,14 @@
import { render, screen } from '@testing-library/react'
import Footer from 'components/Footer'
import packageJSON from '../package.json'
describe('<Footer />', () => {
it('should render correctly', () => {
render(<Footer />)
const content = screen.getByText(`v${packageJSON.version}`)
expect(content).toBeInTheDocument()
})
})