[CHORE] Configure Test env. Add enzyme-to-json snapshot serializer

This commit is contained in:
Oleg Shuralev 2021-02-15 12:08:13 +03:00
parent ad720a8baf
commit ae6ca2bf5c
No known key found for this signature in database
GPG key ID: 99C6BDC0A1C2E647
6 changed files with 14 additions and 23 deletions

View file

@ -15,7 +15,10 @@
},
"ecmaVersion": 2018,
"sourceType": "module",
"project": ["./tsconfig.json", "./src/setupTests.ts"]
"project": [
"./tsconfig.json",
"./src/setupTests.ts"
]
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
@ -30,7 +33,8 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"jsx-a11y/label-has-associated-control": "off",
"import/prefer-default-export": "off",
"@typescript-eslint/no-explicit-any": "error"
"@typescript-eslint/no-explicit-any": "error",
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }]
},
"overrides": [
{

View file

@ -1,8 +0,0 @@
module.exports = {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};

View file

@ -2081,14 +2081,6 @@
"@types/node": "*",
"@types/yargs": "^15.0.0",
"chalk": "^4.0.0"
},
"dependencies": {
"@types/node": {
"version": "14.14.22",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.22.tgz",
"integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==",
"dev": true
}
}
},
"@nodelib/fs.scandir": {

View file

@ -64,6 +64,7 @@
]
},
"devDependencies": {
"@jest/types": "^26.6.2",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.1.2",
@ -108,5 +109,8 @@
"engines": {
"node": ">=14.15.4"
},
"proxy": "http://localhost:8080"
"proxy": "http://localhost:8080",
"jest": {
"snapshotSerializers": ["enzyme-to-json/serializer"]
}
}

View file

@ -1,6 +1,5 @@
/* eslint-disable */
import * as Enzyme from 'enzyme';
import { configure } from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import '@testing-library/jest-dom/extend-expect';
Enzyme.configure({ adapter: new Adapter() });
configure({ adapter: new Adapter() });

View file

@ -22,6 +22,6 @@
"noFallthroughCasesInSwitch": true
},
"include": [
"src"
"src",
]
}