lint-staged
Advanced tools
Comparing version 3.4.1 to 3.4.2
@@ -58,3 +58,3 @@ { | ||
"babel-core": "^6.10.4", | ||
"babel-jest": "^19.0.0", | ||
"babel-jest": "^20.0.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
@@ -68,3 +68,3 @@ "babel-preset-stage-0": "^6.5.0", | ||
"is-promise": "^2.1.0", | ||
"jest": "^19.0.2", | ||
"jest": "^20.0.1", | ||
"jsonlint": "^1.6.2", | ||
@@ -81,3 +81,3 @@ "jsonlint-cli": "^1.0.1", | ||
}, | ||
"version": "3.4.1" | ||
"version": "3.4.2" | ||
} |
@@ -155,3 +155,3 @@ # lint-staged [![Build Status](https://travis-ci.org/okonet/lint-staged.svg?branch=master)](https://travis-ci.org/okonet/lint-staged) [![npm version](https://badge.fury.io/js/lint-staged.svg)](https://badge.fury.io/js/lint-staged) | ||
All examples assuming you’ve already set up lint-staged and pre-commit in the `package.json` | ||
All examples assuming you’ve already set up lint-staged and husky in the `package.json`. | ||
@@ -163,5 +163,5 @@ ```json | ||
"scripts": { | ||
"lint-staged": "lint-staged" | ||
"precommit": "lint-staged" | ||
}, | ||
"pre-commit": "lint-staged" | ||
"lint-staged": {} | ||
} | ||
@@ -168,0 +168,0 @@ ``` |
@@ -13,4 +13,6 @@ 'use strict' | ||
const res = findBin(linter, pathsToLint, packageJson, options) | ||
// Only use gitDir as CWD if we are using the git binary | ||
// e.g `npm` should run tasks in the actual CWD | ||
const execaOptions = | ||
res.bin !== 'npm' && options && options.gitDir ? { cwd: options.gitDir } : {} | ||
res.bin.endsWith('git') && options && options.gitDir ? { cwd: options.gitDir } : {} | ||
return new Promise((resolve, reject) => { | ||
@@ -33,2 +35,1 @@ execa(res.bin, res.args, execaOptions) | ||
} | ||
@@ -1,3 +0,1 @@ | ||
jest.genMockFromModule('execa') | ||
module.exports = jest.fn() |
@@ -33,2 +33,3 @@ /* eslint no-underscore-dangle: 0 */ | ||
mockFn.mockReset() | ||
mockFn.mockImplementation(() => new Promise(() => {})) | ||
}) | ||
@@ -109,2 +110,16 @@ | ||
it('should not pass `gitDir` as `cwd` to `execa()` if a non-git binary is called', () => { | ||
const res = runScript( | ||
['jest'], | ||
'test.js', | ||
packageJSON, | ||
{ gitDir: '../' } | ||
) | ||
expect(res[0].task()).toBeAPromise() | ||
expect(mockFn.mock.calls.length).toEqual(1) | ||
expect(mockFn.mock.calls[0]).toEqual( | ||
['jest', ['--', 'test.js'], {}] | ||
) | ||
}) | ||
it('should use --silent in non-verbose mode', () => { | ||
@@ -138,2 +153,1 @@ const res = runScript( | ||
}) | ||
33314
21
602