Skip to content

Commit

Permalink
Loads of unit tests and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
et0and committed Sep 23, 2024
1 parent ddbc59a commit f8e35ac
Show file tree
Hide file tree
Showing 53 changed files with 10,647 additions and 5,616 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
- "*/*"

jobs:
lint_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Run tests
run: npm test

- name: Run snapshot tests
run: npm test -- -u

- name: Check formatting
run: npx prettier --check "./**/*.{ts,tsx}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
.yarn/install-state.gz
.swc

# testing
/coverage
Expand Down
18 changes: 18 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from "jest";
import nextJest from "next/jest.js";

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: "v8",
testEnvironment: "jsdom",
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);
Loading

0 comments on commit f8e35ac

Please sign in to comment.