mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 00:20:05 +01:00
Added Jest/testing support
This commit is contained in:
parent
ca2bcae5b4
commit
266cae5354
|
|
@ -2,12 +2,14 @@
|
|||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true,
|
||||
"jest": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jest/recommended",
|
||||
"plugin:react/recommended",
|
||||
"prettier"
|
||||
],
|
||||
|
|
@ -22,7 +24,7 @@
|
|||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "react", "simple-import-sort"],
|
||||
"plugins": ["@typescript-eslint", "jest", "react", "simple-import-sort"],
|
||||
"rules": {
|
||||
"max-lines": ["error", 80],
|
||||
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }],
|
||||
|
|
|
|||
9
__tests__/pages/index.spec.tsx
Normal file
9
__tests__/pages/index.spec.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { render } from '@testing-library/react';
|
||||
import Index from 'pages/index';
|
||||
|
||||
test('renders index page', () => {
|
||||
const { getByText } = render(<Index />);
|
||||
const helloWorldElement = getByText('Hello, world!');
|
||||
|
||||
expect(helloWorldElement).toBeInTheDocument();
|
||||
});
|
||||
4
jest.config.js
Normal file
4
jest.config.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
moduleDirectories: ['.', 'node_modules'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js']
|
||||
};
|
||||
1
jest.setup.js
Normal file
1
jest.setup.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import '@testing-library/jest-dom/extend-expect';
|
||||
3856
package-lock.json
generated
3856
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -9,7 +9,8 @@
|
|||
"eslint": "eslint .",
|
||||
"stylelint": "stylelint **/*.scss",
|
||||
"prettier": "prettier --write .",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -24,6 +25,9 @@
|
|||
"sass": "^1.32.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^5.11.8",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/node": "^14.14.20",
|
||||
"@types/react": "^17.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.12.0",
|
||||
|
|
@ -33,11 +37,13 @@
|
|||
"eslint-config-prettier": "^7.1.0",
|
||||
"eslint-import-resolver-typescript": "^2.3.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jest": "^24.1.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-react": "^7.22.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||
"husky": "^4.3.7",
|
||||
"jest": "^26.6.3",
|
||||
"lint-staged": "^10.5.3",
|
||||
"prettier": "2.2.1",
|
||||
"stylelint": "^13.8.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user