Skip to content

Commit

Permalink
ci(jest): Setup jest for frontend app
Browse files Browse the repository at this point in the history
Refs: #1
  • Loading branch information
maikbasel committed Dec 19, 2023
1 parent d25d9a9 commit 3d5e082
Show file tree
Hide file tree
Showing 5 changed files with 6,409 additions and 1,868 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals",
"env": {
"jest/globals": true
},
"plugins": ["jest"]
}
17 changes: 17 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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',
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)
1 change: 1 addition & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
Loading

0 comments on commit 3d5e082

Please sign in to comment.