Husky Hook 无法与 Test 一起正常工作

问题描述

如果 Huskycommits 同时指控 prettiereslint,我正在配置 error 以阻止 warn,并阻止push 如果它没有通过 tests

但是,在运行 test 时,test CLI 会显示(如下图所示),这样,没有任何键起作用,但我只能通过点击快捷方式 ctrl+z 来完成, 暂停我的 push

我的代码 .HUSKY 文件夹:

预提交

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn prettier-check
yarn lint-check

预推

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn test

我的 PACKAGE.JSON

{
    "name": "web-whatsapp","version": "0.0.0","private": true,"scripts": {
        "start": "react-scripts start","build": "react-scripts build","test": "react-scripts test","eject": "react-scripts eject","prettier-check": "prettier --check 'src/**/*.{ts,tsx}'","prettier-fix": "prettier --write 'src/**/*.{ts,"lint-check": "eslint 'src/**/*.{ts,"lint-fix": "eslint --fix 'src/**/*.{ts,"prepare": "husky install"
    },"dependencies": {
        "@testing-library/jest-dom": "^5.11.4","@testing-library/react": "^11.1.0","@testing-library/user-event": "^12.1.10","@types/jest": "^26.0.15","@types/node": "^12.0.0","@types/react": "^17.0.0","@types/react-dom": "^17.0.0","react": "^17.0.2","react-dom": "^17.0.2","react-scripts": "4.0.3","styled-components": "^5.2.3","typescript": "^4.1.2","web-vitals": "^1.0.1"
    },"devDependencies": {
        "@typescript-eslint/eslint-plugin": "^4.22.0","@typescript-eslint/parser": "^4.22.0","eslint": "^7.24.0","eslint-config-airbnb": "^18.2.1","eslint-config-prettier": "^8.2.0","eslint-plugin-import": "^2.22.1","eslint-plugin-jest": "^24.3.5","eslint-plugin-jsx-a11y": "^6.4.1","eslint-plugin-prettier": "^3.3.1","eslint-plugin-react": "^7.23.2","eslint-plugin-react-hooks": "^4.2.0","eslint-plugin-testing-library": "^4.0.1","husky": "^6.0.0","lint-staged": "^10.5.4","prettier": "^2.2.1"
    },"browserslist": {
        "production": [
            ">0.2%","not dead","not op_mini all"
        ],"development": [
            "last 1 chrome version","last 1 firefox version","last 1 safari version"
        ]
    }
}

Problem

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)