Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Screenshot testing #116

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 76 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,81 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Typecheck (React 18)
run: |
npm i --no-save @types/react@18 @types/react-dom@18
npm run typecheck
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Unit Tests
run: npm run test
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Typecheck (React 18)
run: |
npm i --no-save @types/react@18 @types/react-dom@18
npm run typecheck

tests_units:
name: Unit testing
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Unit Tests
run: npm run test:units

test_screenshots:
name: Screenshot testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'

- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test:screenshots

- name: Upload screenshots
id: upload-artifacts
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tests/screenshots/tests/__image_snapshots__

- name: Log Artifact ID
run: echo "Artifact ID= ${{ steps.upload-artifacts.outputs.artifact_id }}"
9 changes: 9 additions & 0 deletions jest.config.screenshots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {Config} from '@jest/types';

const cfg: Config.InitialOptions = {
preset: 'ts-jest',
roots: ['<rootDir>/tests/screenshots'],
globalTeardown: '<rootDir>/tests/screenshots/teardown.ts',
};

export default cfg;
1 change: 1 addition & 0 deletions jest.config.ts → jest.config.units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const cfg: Config.InitialOptions = {
coverageReporters: ['json', 'html'],
coverageDirectory: './coverage',
setupFiles: ['<rootDir>/tests/setup.js'],
roots: ['<rootDir>/tests/units'],
};

export default cfg;
Loading
Loading