Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HUSKY_SKIP_INSTALL=1 not skipping install #518

Merged
merged 1 commit into from Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/installer/__tests__/index.ts
Expand Up @@ -303,6 +303,15 @@ describe('install', (): void => {
expect(hook).toMatch(huskyIdentifier)
})

it('should not install hooks if HUSKY_SKIP_INSTALL=1', (): void => {
mkdir(defaultGitDir, defaultHuskyDir)
writeFile('package.json', pkg)

process.env.HUSKY_SKIP_INSTALL = '1'
install()
expect(exists(defaultHookFilename)).toBeFalsy()
})

it('should not install hooks if HUSKY_SKIP_INSTALL=true', (): void => {
mkdir(defaultGitDir, defaultHuskyDir)
writeFile('package.json', pkg)
Expand Down
2 changes: 1 addition & 1 deletion src/installer/index.ts
Expand Up @@ -137,7 +137,7 @@ export function install(
const conf = getConf(userPkgDir)

// Checks
if (process.env.HUSKY_SKIP_INSTALL === 'true') {
if (['1', 'true'].includes(process.env.HUSKY_SKIP_INSTALL || '')) {
console.log(
"HUSKY_SKIP_INSTALL environment variable is set to 'true',",
'skipping Git hooks installation.'
Expand Down