diff --git a/lib/runAll.js b/lib/runAll.js index 66951c0c1..fe5fd1a4e 100644 --- a/lib/runAll.js +++ b/lib/runAll.js @@ -106,8 +106,7 @@ const runAll = async ( // If there are no files avoid executing any lint-staged logic if (files.length === 0) { - logger.log('No staged files found.') - return 'No tasks to run.' + return logger.log(`${symbols.info} No staged files found.`) } const stagedFileChunks = chunkFiles({ files, gitDir, maxArgLength, relative }) diff --git a/test/__snapshots__/runAll.spec.js.snap b/test/__snapshots__/runAll.spec.js.snap index 2140eb414..c0f1bb48d 100644 --- a/test/__snapshots__/runAll.spec.js.snap +++ b/test/__snapshots__/runAll.spec.js.snap @@ -18,7 +18,7 @@ LOG Cleaning up... [completed]" exports[`runAll should resolve the promise with no files 1`] = ` " -LOG No staged files found." +LOG i No staged files found." `; exports[`runAll should skip applying unstaged modifications if there are errors during linting 1`] = ` @@ -85,5 +85,5 @@ LOG { exports[`runAll should use an injected logger 1`] = ` " -LOG No staged files found." +LOG i No staged files found." `; diff --git a/test/runAll.spec.js b/test/runAll.spec.js index f19b7562a..ffdf0387a 100644 --- a/test/runAll.spec.js +++ b/test/runAll.spec.js @@ -33,8 +33,7 @@ describe('runAll', () => { }) it('should resolve the promise with no tasks', async () => { - const res = await runAll({ config: {} }) - expect(res).toEqual('No tasks to run.') + await expect(runAll({ config: {} })).resolves }) it('should resolve the promise with no files', async () => { diff --git a/test/runAll.unmocked.spec.js b/test/runAll.unmocked.spec.js index f4ec637de..f4e94fdc5 100644 --- a/test/runAll.unmocked.spec.js +++ b/test/runAll.unmocked.spec.js @@ -115,8 +115,7 @@ describe('runAll', () => { }) it('should exit early with no staged files', async () => { - const status = await runAll({ config: { '*.js': 'echo success' }, cwd }) - expect(status).toEqual('No tasks to run.') + expect(() => runAll({ config: { '*.js': 'echo success' }, cwd })).resolves }) it('Should commit entire staged file when no errors from linter', async () => {