@@ -29,7 +29,7 @@ import lintStaged from '../lib/index'
29
29
30
30
import { replaceSerializer } from './utils/replaceSerializer'
31
31
import { createTempDir } from './utils/tempDir'
32
- import { isWindowsActions , normalizeWindowsNewlines } from './utils/crossPlatform'
32
+ import { isWindows , isWindowsActions , normalizeWindowsNewlines } from './utils/crossPlatform'
33
33
34
34
jest . setTimeout ( 20000 )
35
35
jest . retryTimes ( 2 )
@@ -97,7 +97,7 @@ const appendFile = async (filename, content, dir = cwd) => {
97
97
const writeFile = async ( filename , content , dir = cwd ) => {
98
98
const filepath = path . isAbsolute ( filename ) ? filename : path . join ( dir , filename )
99
99
await ensureDir ( filepath )
100
- fs . writeFile ( filepath , content )
100
+ await fs . writeFile ( filepath , content )
101
101
}
102
102
103
103
// Wrap execGit to always pass `gitOps`
@@ -449,9 +449,10 @@ describe('lint-staged', () => {
449
449
// The task creates a git lock file and runs `git add` to simulate failure
450
450
await expect (
451
451
gitCommit ( {
452
+ shell : isWindows ,
452
453
config : {
453
454
'*.js' : ( files ) => [
454
- `touch ${ cwd } /.git/index.lock` ,
455
+ `${ isWindows ? 'type nul >' : ' touch' } ${ cwd } /.git/index.lock` ,
455
456
`prettier --write ${ files . join ( ' ' ) } ` ,
456
457
`git add ${ files . join ( ' ' ) } ` ,
457
458
] ,
0 commit comments