diff --git a/index.ts b/index.ts index 2b2a69f3..7d97e012 100755 --- a/index.ts +++ b/index.ts @@ -424,6 +424,7 @@ commander nonIgnoredFilePaths.map((filePath: string) => { console.error(`└─ ${filePath}`); }); + process.exit(-1); } else { nonIgnoredFilePaths.map((filePath: string) => { console.log(`└─ ${filePath}`); diff --git a/tests/test.ts b/tests/test.ts index dc71975e..38d31648 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -105,6 +105,16 @@ describe.skip('Test clasp push function', () => { expect(result.stdout).to.contain('files.'); expect(result.status).to.equal(0); }); + it('should return non-0 exit code when push failed', () => { + fs.writeFileSync('.claspignore', '**/**\n!Code.js\n!appsscript.json'); + fs.writeFileSync('unexpected_file', ''); + const result = spawnSync( + 'clasp', ['push'], { encoding: 'utf8' }, + ); + expect(result.stdout).to.contain('failed.'); + expect(result.stdout).to.contain('files.'); + expect(result.status).to.equal(-1); + }); }); describe.skip('Test clasp status function', () => {