-
-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
--no-stash
flag implies --no-hide-partially-staged
- Loading branch information
Showing
9 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import './__mocks__/resolveConfig.js' | ||
|
||
import { jest } from '@jest/globals' | ||
|
||
import { withGitIntegration } from './__utils__/withGitIntegration.js' | ||
import * as fileFixtures from './__fixtures__/files.js' | ||
import * as configFixtures from './__fixtures__/configs.js' | ||
|
||
jest.setTimeout(20000) | ||
jest.retryTimes(2) | ||
|
||
describe('lint-staged', () => { | ||
test( | ||
'skips hiding unstaged changes from partially staged files with --no-hide-partially-staged', | ||
withGitIntegration(async ({ execGit, gitCommit, readFile, writeFile }) => { | ||
await writeFile('.lintstagedrc.json', JSON.stringify(configFixtures.prettierWrite)) | ||
|
||
// Stage ugly file | ||
await writeFile('test.js', fileFixtures.uglyJS) | ||
await execGit(['add', 'test.js']) | ||
|
||
// modify file with unstaged changes | ||
await writeFile('test.js', fileFixtures.uglyJSWithChanges) | ||
|
||
// Run lint-staged with --no-hide-partially-staged | ||
const stdout = await gitCommit({ lintStaged: { hidePartiallyStaged: false } }) | ||
|
||
expect(stdout).toMatch( | ||
'Skipping hiding unstaged changes from partially staged files because `--no-hide-partially-staged` was used' | ||
) | ||
|
||
// Nothing is wrong, so a new commit is created | ||
expect(await execGit(['rev-list', '--count', 'HEAD'])).toEqual('2') | ||
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatch('test') | ||
expect(await readFile('test.js')).toEqual(fileFixtures.prettyJSWithChanges) | ||
}) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters