From 4f0974341c3c4a2738459cadf0f84e6bd8ddfc4c Mon Sep 17 00:00:00 2001 From: Takahiko Inayama Date: Mon, 21 May 2018 16:37:27 +0900 Subject: [PATCH] Return -1 when push failed (#175) Fixes #174 - [x] `npm run test` succeeds. - [x] `npm run lint` succeeds. - [ ] Appropriate changes to README are included in PR. --- index.ts | 1 + tests/test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) 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', () => {