diff --git a/bin.js b/bin.js index 11164946d..13011eb92 100755 --- a/bin.js +++ b/bin.js @@ -7,7 +7,7 @@ let a = process.argv[2] if (a == 'init') { let p = 'package.json' let d = JSON.parse(f.readFileSync(p)) - (d.scripts ||= {}).prepare = 'husky' + ;(d.scripts ||= {}).prepare = 'husky' w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n') process.stdout.write(i()) try { f.mkdirSync('.husky') } catch {} diff --git a/test.sh b/test.sh index 5333af740..6f6d9d406 100755 --- a/test.sh +++ b/test.sh @@ -8,4 +8,5 @@ sh test/3_from-sub-dir.sh sh test/4_not-git-dir.sh sh test/5_git_command_not_found.sh sh test/6_command_not_found.sh -# sh test/7_time.sh +sh test/7_init.sh +# sh test/8_time.sh diff --git a/test/7_init.sh b/test/7_init.sh new file mode 100644 index 000000000..7a498cc41 --- /dev/null +++ b/test/7_init.sh @@ -0,0 +1,6 @@ +#!/bin/sh +. test/functions.sh +setup +install + +npx --no-install husky init \ No newline at end of file diff --git a/test/7_time.sh b/test/8_time.sh similarity index 100% rename from test/7_time.sh rename to test/8_time.sh