File: 3_from-sub-dir.sh

package info (click to toggle)
node-husky 9.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 952 kB
  • sloc: sh: 182; javascript: 79; makefile: 9
file content (35 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
. test/functions.sh
setup

# Skip test for npm 6
npm --version | grep "^6\." && exit 0

# Example:
# .git
# sub/package.json

# Edit package.json in sub directory
mkdir sub
cd sub
npm install ../../husky.tgz
cat >package.json <<EOL
{
	"scripts": {
		"prepare": "cd .. && husky sub/.husky"
	}
}
EOL

# Install
npm run prepare

# Add hook
echo "echo \"pre-commit hook\" && exit 1" >.husky/pre-commit

# Test core.hooksPath
expect_hooksPath_to_be "sub/.husky/_"

# Test pre-commit
git add package.json
expect 1 "git commit -m foo"