Add Jest setup for unit testing (#731)

* install jest

* rename test script name

* test Safari detection logic

* don't expose implementation details for testing

* fix jest config

* contrib build

* don't expose impl details for testing
main
souppower 6 years ago committed by Michael Fix
parent 4d2b212f69
commit 36b582cc60

@ -481,6 +481,15 @@
"contributions": [ "contributions": [
"code" "code"
] ]
},
{
"login": "souppower",
"name": "souppower",
"avatar_url": "https://avatars2.githubusercontent.com/u/19849611?v=4",
"profile": "https://github.com/souppower",
"contributions": [
"infra"
]
} }
], ],
"repoType": "github" "repoType": "github"

@ -0,0 +1,3 @@
{
"presets": ["next/babel"]
}

@ -4,7 +4,7 @@ module.exports = {
browser: true, browser: true,
es6: true, es6: true,
node: true, node: true,
mocha: true jest: true
}, },
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:jsx-a11y/recommended'], extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:jsx-a11y/recommended'],
parserOptions: { parserOptions: {

1
.gitignore vendored

@ -7,3 +7,4 @@ cypress/screenshots
.idea .idea
.DS_Store .DS_Store
packaged packaged
coverage

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,7 +8,8 @@
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"export": "next export", "export": "next export",
"test": "npm run cy:run --", "test": "jest",
"test:e2e": "npm run cy:run --",
"deploy": "now", "deploy": "now",
"prettier": "prettier --config .prettierrc --write {.,components,lib,pages}/*.js {components,lib,pages,packages}/**/*.js", "prettier": "prettier --config .prettierrc --write {.,components,lib,pages}/*.js {components,lib,pages,packages}/**/*.js",
"lint": "eslint .", "lint": "eslint .",
@ -62,6 +63,7 @@
"eslint-plugin-react": "^7.12.3", "eslint-plugin-react": "^7.12.3",
"eslint-plugin-react-hooks": "^1.4.0", "eslint-plugin-react-hooks": "^1.4.0",
"husky": "^1.3.1", "husky": "^1.3.1",
"jest": "^24.7.1",
"lint-staged": "^8.1.3", "lint-staged": "^8.1.3",
"now": "^15.0.0", "now": "^15.0.0",
"wait-on": "^3.2.0" "wait-on": "^3.2.0"

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save