diff --git a/lib/gitWorkflow.js b/lib/gitWorkflow.js index 315cfe272..f7dea4f64 100644 --- a/lib/gitWorkflow.js +++ b/lib/gitWorkflow.js @@ -105,7 +105,7 @@ class GitWorkflow { debug('Detected files modified by tasks:') debug(modifiedFiles) debug('Adding files to index...') - await this.execGit(['add', modifiedFiles]) + await this.execGit(['add', '.']) debug('Done adding files to index!') } diff --git a/test/runAll.unmocked.spec.js b/test/runAll.unmocked.spec.js index b9e4a3281..84d66a56a 100644 --- a/test/runAll.unmocked.spec.js +++ b/test/runAll.unmocked.spec.js @@ -129,10 +129,13 @@ describe('runAll', () => { }) it('Should commit entire staged file when no errors and linter modifies file', async () => { - // Stage ugly file + // Stage multiple ugly files await appendFile('test.js', testJsFileUgly) await execGit(['add', 'test.js']) + await appendFile('test2.js', testJsFileUgly) + await execGit(['add', 'test2.js']) + // Run lint-staged with `prettier --write` and commit pretty file await gitCommit(fixJsConfig) @@ -140,6 +143,7 @@ describe('runAll', () => { expect(await execGit(['rev-list', '--count', 'HEAD'])).toEqual('2') expect(await execGit(['log', '-1', '--pretty=%B'])).toMatch('test') expect(await readFile('test.js')).toEqual(testJsFilePretty) + expect(await readFile('test2.js')).toEqual(testJsFilePretty) }) it('Should fail to commit entire staged file when errors from linter', async () => {