fix(ci): errors (#976)

* fix(ci): fsevents

* fix(ci): cipm error

* refactor: move devDependency

* fix(test): use POSIX syntax

* fix(test): support Node 6 in tests

* fix(ci): use npm 7
This commit is contained in:
typicode 2021-05-20 14:50:54 +02:00 committed by GitHub
parent b842bf42d3
commit b5f4bbd723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3822 additions and 21 deletions

View File

@ -21,6 +21,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- name: npm 7
run: npm i -g npm@7
- run: npm ci --ignore-scripts
- run: npm test

3806
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"bootstrap": "lerna bootstrap --no-ci",
"build": "del-cli \"packages/**/lib\" && lerna exec -- tsc && cpy --cwd=./packages/husky src/husky.sh lib",
"lint": "eslint . --ext .ts --ignore-path .gitignore",
"test": "sh test/_run_all.sh",
@ -13,16 +13,19 @@
"devDependencies": {
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
"@commitlint/prompt-cli": "^12.1.4",
"@tsconfig/node12": "^1.0.7",
"@types/jest": "^26.0.22",
"@types/node": "^15.3.1",
"@typicode/eslint-config": "^0.1.2",
"cpy-cli": "^3.1.1",
"del-cli": "^3.0.1",
"docsify-cli": "^4.4.3",
"husky": "^6.0.0",
"jest": "^26.6.3",
"lerna": "^4.0.0",
"ts-jest": "^26.5.4",
"type-fest": "^0.20.2",
"typescript": "^4.2.3"
}
}

View File

@ -9,8 +9,5 @@
},
"author": "Typicode <typicode@gmail.com>",
"license": "MIT",
"devDependencies": {
"type-fest": "^1.0.1"
},
"gitHead": "cb4e3b913e2d8963af3179650ed550d3a0e210f5"
}

View File

@ -1,7 +1,7 @@
# Exit on error
set -eu
function setup {
setup() {
name="$(basename $0)"
testDir="/tmp/husky-test-$name"
echo
@ -25,11 +25,11 @@ function setup {
npm init -y 1>/dev/null
}
function install {
install() {
npm install ../husky.tgz
}
function expect {
expect() {
set +e
sh -c "$2"
exitCode="$?"
@ -39,18 +39,18 @@ function expect {
fi
}
function expect_hooksPath_to_be {
expect_hooksPath_to_be() {
readonly hooksPath=`git config core.hooksPath`
if [ "$hooksPath" != "$1" ]; then
error "core.hooksPath should be $1, was $hooksPath"
fi
}
function error {
error() {
echo -e "\e[0;31mERROR:\e[m $1"
exit 1
}
function ok {
ok() {
echo -e "\e[0;32mOK\e[m"
}

View File

@ -1,14 +1,23 @@
. "$(dirname "$0")/_functions.sh"
setup
npm link husky-init
cat > package.json << EOL
{
"scripts": {
"test": "echo \"pre-commit hook\" && exit 1"
}
}
EOL
npm link husky-init
npx --no-install husky-init
npm set-script test "echo \"pre-commit hook\" && exit 1"
# Test package.json scripts
# husky-init should create prepare script
expect 0 "grep '\"prepare\": \"husky install\"' package.json"
# Test core.hooksPath
# husky-init should install husky
expect_hooksPath_to_be ".husky"
# Test pre-commit