Skip to content

Commit

Permalink
Merge pull request #901 from okonet/fix-supports-color
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj authored Aug 25, 2020
2 parents 86c9ed2 + 7a5182b commit 10b3218
Show file tree
Hide file tree
Showing 6 changed files with 1,341 additions and 1,024 deletions.
2 changes: 1 addition & 1 deletion bin/lint-staged.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

Expand Down
1 change: 1 addition & 0 deletions lib/gitWorkflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const GIT_DIFF_ARGS = [
'--src-prefix=a/', // force prefix for consistent behaviour
'--dst-prefix=b/', // force prefix for consistent behaviour
'--patch', // output a patch that can be applied
'--submodule=short', // always use the default short format for submodules
]
const GIT_APPLY_ARGS = ['-v', '--whitespace=nowarn', '--recount', '--unidiff-zero']

Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
}
},
"dependencies": {
"chalk": "^4.0.0",
"cli-truncate": "2.1.0",
"commander": "^5.1.0",
"cosmiconfig": "^6.0.0",
"chalk": "^4.1.0",
"cli-truncate": "^2.1.0",
"commander": "^6.0.0",
"cosmiconfig": "^7.0.0",
"debug": "^4.1.1",
"dedent": "^0.7.0",
"enquirer": "^2.3.5",
"execa": "^4.0.1",
"listr2": "^2.1.0",
"enquirer": "^2.3.6",
"execa": "^4.0.3",
"listr2": "^2.6.0",
"log-symbols": "^4.0.0",
"micromatch": "^4.0.2",
"normalize-path": "^3.0.0",
Expand All @@ -49,22 +49,22 @@
"stringify-object": "^3.3.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/core": "^7.11.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"babel-eslint": "10.1.0",
"babel-jest": "^26.0.1",
"babel-jest": "^26.3.0",
"consolemock": "^1.1.0",
"eslint": "^7.0.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"fs-extra": "^9.0.0",
"eslint-plugin-prettier": "^3.1.4",
"fs-extra": "^9.0.1",
"husky": "^4.2.5",
"jest": "^26.0.1",
"jest": "^26.4.2",
"jest-snapshot-serializer-ansi": "^1.0.0",
"prettier": "^2.0.5"
"prettier": "^2.1.0"
},
"config": {
"commitizen": {
Expand Down
11 changes: 4 additions & 7 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,10 @@ describe('lint-staged', () => {

// Nothing is wrong, so a new commit is created and file is pretty
expect(await execGit(['rev-list', '--count', 'HEAD'])).toEqual('4')
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatchInlineSnapshot(`
"Merge branch 'branch-b'
# Conflicts:
# test.js
"
`)
const log = await execGit(['log', '-1', '--pretty=%B'])
expect(log).toMatch(`Merge branch 'branch-b`)
expect(log).toMatch(`Conflicts:`)
expect(log).toMatch(`test.js`)
expect(await readFile('test.js')).toEqual(fileInBranchBFixed)
})

Expand Down
9 changes: 8 additions & 1 deletion test/runAll.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ describe('runAll', () => {
LOG [STARTED] Preparing...
ERROR [FAILED] test
LOG [STARTED] Running tasks...
INFO [SKIPPED] Skipped because of previous git error.
LOG [STARTED] Applying modifications...
LOG [STARTED] Cleaning up..."
INFO [SKIPPED]
[SKIPPED] × lint-staged failed due to a git error.
LOG [STARTED] Cleaning up...
INFO [SKIPPED]
[SKIPPED] × lint-staged failed due to a git error."
`)
})

Expand Down Expand Up @@ -158,6 +163,7 @@ describe('runAll', () => {
ERROR [FAILED] echo \\"sample\\" [1]
LOG [SUCCESS] Running tasks...
LOG [STARTED] Applying modifications...
INFO [SKIPPED] Skipped because of errors from tasks.
LOG [STARTED] Reverting to original state because of errors...
LOG [SUCCESS] Reverting to original state because of errors...
LOG [STARTED] Cleaning up...
Expand Down Expand Up @@ -195,6 +201,7 @@ describe('runAll', () => {
ERROR [FAILED] echo \\"sample\\" [SIGINT]
LOG [SUCCESS] Running tasks...
LOG [STARTED] Applying modifications...
INFO [SKIPPED] Skipped because of errors from tasks.
LOG [STARTED] Reverting to original state because of errors...
LOG [SUCCESS] Reverting to original state because of errors...
LOG [STARTED] Cleaning up...
Expand Down
Loading

0 comments on commit 10b3218

Please sign in to comment.