feature/ga
Eric 4 years ago
parent 3874be66b0
commit 9d0579a662

@ -1,20 +1,13 @@
module.exports = {
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
},
transformIgnorePatterns: [
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
],
moduleNameMapper: {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
},
const nextJest = require('next/jest')
const createJestConfig = nextJest({
dir: './',
})
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
}
module.exports = createJestConfig(customJestConfig)

@ -0,0 +1,6 @@
// Optional: configure or set up a testing framework before each test.
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
// Used for __tests__/testing-library.js
// Learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect'

@ -1,5 +0,0 @@
// jest.setup.ts
import '@testing-library/jest-dom';
configure({ adapter: new ReactAdapter() });

@ -11,7 +11,8 @@
"start": "next start",
"db": "npx prisma migrate reset --force",
"test": "jest --watch",
"test-e2e" : "playwright test"
"test-e2e" : "playwright test",
"test:ci" : "jest --ci"
},
"dependencies": {
"@hookform/resolvers": "^2.9.10",

@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react'
describe('Index', () => {
it('renders button discover my gift', () => {
it('should show win content if the code is valide', () => {
const button = screen.getByRole('button', {
name: /Découvrir mon cadeau \.js!/i,
})

@ -26,7 +26,6 @@
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"tests/**.ts"
],
"ts-node": {
"compilerOptions": {

Loading…
Cancel
Save