Skip to content

Commit

Permalink
🎉 (jest) NICE-27 add better poc for 🃏
Browse files Browse the repository at this point in the history
♻️  (jest) NICE-27 var swaps
  • Loading branch information
JeromeFitz committed Apr 23, 2023
1 parent 5e52fd2 commit 930f8b4
Show file tree
Hide file tree
Showing 22 changed files with 523 additions and 86 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 26,7 @@ module.exports = {
'@jeromefitz/eslint-config/react.cjs',
],
ignorePatterns: ['next-env.d.ts'],
plugins: ['testing-library'],
root: true,
reportUnusedDisableDirectives: true,
overrides: [
Expand Down Expand Up @@ -53,5 54,14 @@ module.exports = {
extends: ['plugin:playwright/playwright-test'],
files: ['**/*.e2e.{js,jsx,ts,tsx}'],
},
// ⚙️ jest
{
extends: [
// '@jeromefitz/eslint-config/react.cjs',
'plugin:testing-library/react',
'plugin:jest-dom/recommended',
],
files: ['**/*.{spec,test}.{js,jsx,ts,tsx}'],
},
],
}
4 changes: 4 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 34,10 @@ runs:
run: |
pnpm turbo run build --filter="${{ inputs.WEBSITE }}" --cache-dir=".cache-turbo"
- name: '🃏 Jest: unit'
id: test-jest
run: pnpm turbo run test:unit --filter="${{ inputs.WEBSITE }}"

- name: '💡 Run Lighthouse on: ${{ inputs.WEBSITE }}'
id: test-lighthouse
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 48,7 @@ yarn-error.log*
.lighthouseci
.tsbuildinfo
build-info.json
coverage
e2e-report
e2e-results
out
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 12,7 @@ coverage
**/.vercel/**
**/.vercel*/**
**/bundles/**
**/coverage/**
**/dist/**
**/e2e-report/**
**/e2e-results/**
Expand Down
1 change: 1 addition & 0 deletions .prettierignore_staged
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 12,7 @@ coverage
**/.vercel/**
**/.vercel*/**
**/bundles/**
**/coverage/**
**/dist/**
**/e2e-report/**
**/e2e-results/**
Expand Down
16 changes: 0 additions & 16 deletions jest.config.ts

This file was deleted.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 42,25 @@
"@storybook/blocks": "7.0.6",
"@storybook/jest": "0.1.0",
"@storybook/react": "7.0.6",
"@storybook/testing-library": "0.1.0",
"@testing-library/dom": "9.2.0",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/is-ci": "3.0.0",
"@types/jest": "29.5.1",
"@types/lodash": "4.14.194",
"@types/node": "18.15.13",
"@types/react": "18.0.38",
"@types/testing-library__jest-dom": "5.14.5",
"@types/title": "3.4.1",
"@types/uuid": "9.0.1",
"ccommit": "1.1.2",
"concurrently": "8.0.1",
"dotenv": "16.0.3",
"eslint-plugin-jest-dom": "4.0.3",
"eslint-plugin-playwright": "0.12.0",
"eslint-plugin-storybook": "0.6.11",
"eslint-plugin-testing-library": "5.10.3",
"husky": "8.0.3",
"is-ci": "3.0.1",
"jest": "29.5.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/jest-config/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@
const nextJest = require('next/jest')

/** @type {import('jest').Config} */
const config = {
coverageReporters: ['text', 'html'],
setupFilesAfterEnv: ['@jeromefitz/jest-config/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
watchman: false,
}

const defineConfig = nextJest({ dir: './' })
module.exports = defineConfig(config)
1 change: 1 addition & 0 deletions packages/jest-config/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
import '@testing-library/jest-dom/extend-expect'
10 changes: 10 additions & 0 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 1,10 @@
{
"name": "@jeromefitz/jest-config",
"version": "0.0.0",
"private": true,
"devDependencies": {
"@testing-library/jest-dom": "5.16.5",
"jest-environment-jsdom": "29.5.0",
"next": "13.3.1"
}
}
Loading

0 comments on commit 930f8b4

Please sign in to comment.