Skip to content

Commit fa52499

Browse files
committed
Add test scripts
1 parent c4103de commit fa52499

14 files changed

Lines changed: 8457 additions & 3346 deletions

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 22.13.0
18+
cache: npm
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run tests with coverage
24+
run: npm run test:ci
25+
26+
- name: Upload coverage artifact
27+
if: always()
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: coverage-report
31+
path: coverage
32+
if-no-files-found: ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dist/
1717
# Misc
1818
.DS_Store
1919
*.pem
20+
.swc
2021

2122
# Debug
2223
npm-debug.log*

jest.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const nextJest = require('next/jest');
2+
3+
const createJestConfig = nextJest({
4+
dir: './',
5+
});
6+
7+
const customJestConfig = {
8+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
9+
testEnvironment: 'jest-environment-jsdom',
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/src/$1',
12+
},
13+
collectCoverageFrom: [
14+
'src/**/*.{ts,tsx}',
15+
'!src/**/*.d.ts',
16+
'!src/**/__tests__/**',
17+
],
18+
coverageReporters: ['text', 'lcov', 'json-summary'],
19+
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/dist/'],
20+
};
21+
22+
module.exports = createJestConfig(customJestConfig);

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom';

0 commit comments

Comments
 (0)