feat: add jest incl. init setup (#3)

* feat: add jest incl. init setup

---------

Co-authored-by: Anja-Janina Stiefermann <anja.stiefermann@kernpunkt.de>
This commit is contained in:
leonmargaritis 2023-11-17 14:40:57 +01:00 committed by GitHub
parent feaa87a9c8
commit dc586ce64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1623 additions and 39 deletions

View File

@ -17,19 +17,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
- name: Set pnpm version
uses: pnpm/action-setup@v2
with:
run_install: false
version: 7
- name: Cache node_modules
id: node-modules-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: node-modules-cache-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install dependencies - name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile
run: pnpm install --no-frozen-lockfile
- name: Run tests - name: Run tests
run: pnpm test run: yarn test

5
jest.config.js Normal file
View File

@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node"
};

View File

@ -15,7 +15,7 @@
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"prettier": "prettier --write --ignore-unknown .", "prettier": "prettier --write --ignore-unknown .",
"prettier:check": "prettier --check --ignore-unknown .", "prettier:check": "prettier --check --ignore-unknown .",
"test": "next lint && prettier --check --ignore-unknown ." "test": "yarn lint --strict --fix && yarn jest --passWithNoTests"
}, },
"git": { "git": {
"pre-commit": "lint-staged" "pre-commit": "lint-staged"
@ -37,6 +37,7 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/typography": "^0.5.10", "@tailwindcss/typography": "^0.5.10",
"@types/jest": "^29.5.8",
"@types/node": "20.8.9", "@types/node": "20.8.9",
"@types/react": "18.2.33", "@types/react": "18.2.33",
"@types/react-dom": "18.2.14", "@types/react-dom": "18.2.14",
@ -46,11 +47,13 @@
"eslint-config-next": "^14.0.0", "eslint-config-next": "^14.0.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-unicorn": "^48.0.1", "eslint-plugin-unicorn": "^48.0.1",
"jest": "^29.7.0",
"lint-staged": "^15.0.2", "lint-staged": "^15.0.2",
"postcss": "^8.4.31", "postcss": "^8.4.31",
"prettier": "3.0.3", "prettier": "3.0.3",
"prettier-plugin-tailwindcss": "^0.5.6", "prettier-plugin-tailwindcss": "^0.5.6",
"tailwindcss": "^3.3.5", "tailwindcss": "^3.3.5",
"ts-jest": "^29.1.1",
"typescript": "5.2.2" "typescript": "5.2.2"
} }
} }

1636
yarn.lock

File diff suppressed because it is too large Load Diff