diff --git a/.github/workflows/test-coverage-reoprt.yml b/.github/workflows/test-coverage-reoprt.yml new file mode 100644 index 0000000..d042847 --- /dev/null +++ b/.github/workflows/test-coverage-reoprt.yml @@ -0,0 +1,34 @@ +name: Coverage Report CI + +on: + pull_request: + branches: + - develop + - main + + +jobs: + build: + strategy: + matrix: + node-version: [16.x] + platform: [ubuntu-latest] + name: Run Coverage Tests + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - name: Install packages + run: yarn install --prefer-offline --immutable + - name: Run Tests + run: yarn run test:ci + - name: Test Coverage report + id: testCoverage + uses: anuraag016/Jest-Coverage-Diff@V1.4 + with: + fullCoverageDiff: true + delta: 0.5 \ No newline at end of file diff --git a/.github/workflows/tests-coverage.yml b/.github/workflows/tests-coverage.yml index 460539c..71cc8d3 100644 --- a/.github/workflows/tests-coverage.yml +++ b/.github/workflows/tests-coverage.yml @@ -1,30 +1,46 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs +# # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Tests CI +# name: Tests CI -on: - pull_request: - branches: ['main', 'develop'] +# on: +# pull_request: +# branches: ['main', 'develop'] -jobs: - build: - name: Run Coverage Tests - runs-on: ubuntu-latest +# jobs: +# build: +# name: Run Coverage Tests +# runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] +# strategy: +# matrix: +# node-version: [16.x] + +# steps: +# - name: Checkout Branch To Runner +# uses: actions/checkout@v3 +# - name: Use Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v3 +# with: +# node-version: ${{ matrix.node-version }} +# cache: 'yarn' +# - name: Install Yarn +# run: yarn install --prefer-offline --immutable +# - name: Run Coverage Tests +# run: yarn run test:ci +# - name: Code Coverage Summary Report +# uses: irongut/CodeCoverageSummary@v1.3.0 +# with: +# filename: coverage/cobertura-coverage.xml +# badge: true +# format: 'markdown' +# output: 'both' +# - name: Add Coverage PR Comment +# uses: marocchino/sticky-pull-request-comment@v2 +# if: github.event_name == 'pull_request' +# with: +# recreate: true +# path: code-coverage-results.md +# - name: Write to Job Summary +# run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY - steps: - - name: Checkout Branch To Runner - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - - name: Install Yarn - run: yarn install --prefer-offline --immutable - - name: Run Coverage Tests - run: yarn run test:ci diff --git a/.gitignore b/.gitignore index 436b302..fbabf1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ node_modules +/coverage /.cache /build /public/build +/coverage .env package-lock.json diff --git a/app/components/__test__/Button.test.tsx b/app/components/__test__/Button.test.tsx new file mode 100644 index 0000000..6a4aa74 --- /dev/null +++ b/app/components/__test__/Button.test.tsx @@ -0,0 +1,61 @@ +import { fireEvent, render } from '@testing-library/react'; + +import { Button, LinkButton } from '../Button'; + +describe('Button', () => { + const btnText = 'Click me'; + it('renders', () => { + const { getByText } = render( +