Skip to content

Commit 10b3218

Browse files
authored
Merge pull request #901 from okonet/fix-supports-color
2 parents 86c9ed2 + 7a5182b commit 10b3218

File tree

6 files changed

+1341
-1024
lines changed

6 files changed

+1341
-1024
lines changed

bin/lint-staged.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Force colors for packages that depend on https://www.npmjs.com/package/supports-color
66
const { supportsColor } = require('chalk')
7-
if (supportsColor) {
7+
if (supportsColor && supportsColor.level) {
88
process.env.FORCE_COLOR = supportsColor.level.toString()
99
}
1010

lib/gitWorkflow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const GIT_DIFF_ARGS = [
5353
'--src-prefix=a/', // force prefix for consistent behaviour
5454
'--dst-prefix=b/', // force prefix for consistent behaviour
5555
'--patch', // output a patch that can be applied
56+
'--submodule=short', // always use the default short format for submodules
5657
]
5758
const GIT_APPLY_ARGS = ['-v', '--whitespace=nowarn', '--recount', '--unidiff-zero']
5859

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
}
3333
},
3434
"dependencies": {
35-
"chalk": "^4.0.0",
36-
"cli-truncate": "2.1.0",
37-
"commander": "^5.1.0",
38-
"cosmiconfig": "^6.0.0",
35+
"chalk": "^4.1.0",
36+
"cli-truncate": "^2.1.0",
37+
"commander": "^6.0.0",
38+
"cosmiconfig": "^7.0.0",
3939
"debug": "^4.1.1",
4040
"dedent": "^0.7.0",
41-
"enquirer": "^2.3.5",
42-
"execa": "^4.0.1",
43-
"listr2": "^2.1.0",
41+
"enquirer": "^2.3.6",
42+
"execa": "^4.0.3",
43+
"listr2": "^2.6.0",
4444
"log-symbols": "^4.0.0",
4545
"micromatch": "^4.0.2",
4646
"normalize-path": "^3.0.0",
@@ -49,22 +49,22 @@
4949
"stringify-object": "^3.3.0"
5050
},
5151
"devDependencies": {
52-
"@babel/core": "^7.9.6",
53-
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
54-
"@babel/preset-env": "^7.9.6",
52+
"@babel/core": "^7.11.4",
53+
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
54+
"@babel/preset-env": "^7.11.0",
5555
"babel-eslint": "10.1.0",
56-
"babel-jest": "^26.0.1",
56+
"babel-jest": "^26.3.0",
5757
"consolemock": "^1.1.0",
58-
"eslint": "^7.0.0",
58+
"eslint": "^7.7.0",
5959
"eslint-config-prettier": "^6.11.0",
60-
"eslint-plugin-import": "^2.20.2",
60+
"eslint-plugin-import": "^2.22.0",
6161
"eslint-plugin-node": "^11.1.0",
62-
"eslint-plugin-prettier": "^3.1.3",
63-
"fs-extra": "^9.0.0",
62+
"eslint-plugin-prettier": "^3.1.4",
63+
"fs-extra": "^9.0.1",
6464
"husky": "^4.2.5",
65-
"jest": "^26.0.1",
65+
"jest": "^26.4.2",
6666
"jest-snapshot-serializer-ansi": "^1.0.0",
67-
"prettier": "^2.0.5"
67+
"prettier": "^2.1.0"
6868
},
6969
"config": {
7070
"commitizen": {

test/integration.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,10 @@ describe('lint-staged', () => {
489489

490490
// Nothing is wrong, so a new commit is created and file is pretty
491491
expect(await execGit(['rev-list', '--count', 'HEAD'])).toEqual('4')
492-
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatchInlineSnapshot(`
493-
"Merge branch 'branch-b'
494-
495-
# Conflicts:
496-
# test.js
497-
"
498-
`)
492+
const log = await execGit(['log', '-1', '--pretty=%B'])
493+
expect(log).toMatch(`Merge branch 'branch-b`)
494+
expect(log).toMatch(`Conflicts:`)
495+
expect(log).toMatch(`test.js`)
499496
expect(await readFile('test.js')).toEqual(fileInBranchBFixed)
500497
})
501498

test/runAll.spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ describe('runAll', () => {
125125
LOG [STARTED] Preparing...
126126
ERROR [FAILED] test
127127
LOG [STARTED] Running tasks...
128+
INFO [SKIPPED] Skipped because of previous git error.
128129
LOG [STARTED] Applying modifications...
129-
LOG [STARTED] Cleaning up..."
130+
INFO [SKIPPED]
131+
[SKIPPED] × lint-staged failed due to a git error.
132+
LOG [STARTED] Cleaning up...
133+
INFO [SKIPPED]
134+
[SKIPPED] × lint-staged failed due to a git error."
130135
`)
131136
})
132137

@@ -158,6 +163,7 @@ describe('runAll', () => {
158163
ERROR [FAILED] echo \\"sample\\" [1]
159164
LOG [SUCCESS] Running tasks...
160165
LOG [STARTED] Applying modifications...
166+
INFO [SKIPPED] Skipped because of errors from tasks.
161167
LOG [STARTED] Reverting to original state because of errors...
162168
LOG [SUCCESS] Reverting to original state because of errors...
163169
LOG [STARTED] Cleaning up...
@@ -195,6 +201,7 @@ describe('runAll', () => {
195201
ERROR [FAILED] echo \\"sample\\" [SIGINT]
196202
LOG [SUCCESS] Running tasks...
197203
LOG [STARTED] Applying modifications...
204+
INFO [SKIPPED] Skipped because of errors from tasks.
198205
LOG [STARTED] Reverting to original state because of errors...
199206
LOG [SUCCESS] Reverting to original state because of errors...
200207
LOG [STARTED] Cleaning up...

0 commit comments

Comments
 (0)