diff --git a/.travis.yml b/.travis.yml index 8f12c12..b2bf8ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,54 +1,59 @@ +language: node_js +node_js: + - 10 + - 12 + - 14 + - lts/* +os: + - windows + - linux + - osx +stages: + - Lint + - Test + - name: Github Release + if: branch = master AND tag IS present + - name: NPM Release + if: branch = master AND tag IS present cache: directories: - - node_modules - + - node_modules jobs: include: + - stage: Lint + os: linux + node_js: lts/* + script: npm run lint - - stage: lint - language: node_js - node_js: lts/* - script: npm run lint - - - stage: test - language: node_js - node_js: - - 10 - - 12 - - 14 - - lts/* - os: - - windows - - linux - - osx - script: npm test - after_success: npm run coveralls + - stage: Test + script: npm test + after_success: npm run coveralls - - stage: build - language: node_js - node_js: lts/* - script: npm run build + - stage: Github Release + os: linux + language: shell + script: npm run build && echo "Deploying to github..." + deploy: + provider: releases + api_key: "$GITHUB_API_KEY" + file_glob: true + skip_cleanup: true + cleanup: false + file: + - "build/ios-uploader-*" + on: + branch: master + tags: true - - stage: npm release - language: node_js - node_js: lts/* - script: echo "Deploying to npm..." - deploy: - provider: npm - email: simon@nilsson.ml - api_key: "$NPM_API_KEY" - on: - tags: true + - stage: NPM Release + os: linux + node_js: lts/* + script: echo "Deploying to npm..." + deploy: + provider: npm + email: simon@nilsson.ml + api_key: "$NPM_API_KEY" + on: + branch: master + tags: true - - stage: github release - language: minimal - script: echo "Deploying to github..." - deploy: - provider: releases - api_key: "$GITHUB_API_KEY" - file_glob: true - file: - - "build/ios-uploader-*" - skip_cleanup: true - on: - tags: true diff --git a/README.md b/README.md index f11e23a..d493259 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![npm](https://img.shields.io/npm/v/ios-uploader.svg?style=flat-square)](https://www.npmjs.org/package/ios-uploader) [![build](https://img.shields.io/travis/simonnilsson/ios-uploader/master.svg?style=flat-square)](https://travis-ci.org/simonnilsson/ios-uploader) -[![coverage](https://coveralls.io/repos/simonnilsson/ios-uploader/badge.svg?branch=master)](https://coveralls.io/r/simonnilsson/ios-uploader?branch=master) +[![coverage](https://coveralls.io/repos/github/simonnilsson/ios-uploader/badge.svg?branch=master)](https://coveralls.io/github/simonnilsson/ios-uploader?branch=master) [![install size](https://packagephobia.com/badge?p=ios-uploader)](https://packagephobia.com/result?p=ios-uploader) Easy to use, cross-platform tool to upload an iOS app to iTunes Connect. diff --git a/test/index.test.js b/test/index.test.js index acc54bf..a7325db 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -55,9 +55,9 @@ describe('lib/index', () => { fileModifiedTime: TEST_CTX.fileModifiedTime, fileChecksum: TEST_CTX.fileChecksum, metadataBuffer: sinon.match.instanceOf(Buffer), - metadataChecksum: TEST_CTX.metadataChecksum, - metadataCompressed: TEST_CTX.metadataCompressed, - metadataSize: TEST_CTX.metadataSize + metadataChecksum: sinon.match.string, + metadataCompressed: sinon.match.string, + metadataSize: sinon.match.number }; sinon.assert.match(ctx, Object.assign({}, METADATA_INPUT, EXPECTED_METADATA)); }); diff --git a/test/utility.test.js b/test/utility.test.js index ff32a52..b8344ad 100644 --- a/test/utility.test.js +++ b/test/utility.test.js @@ -100,37 +100,42 @@ describe('lib/utility', () => { before(() => { let readStreamStub = sinon.stub(fs, 'createReadStream'); readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 1 })).callsFake(() => { - let s = new stream.Readable(); - s.push('data'); - s.push(null); - return s; + return new stream.Readable({ + read: function() { + this.push('data'); + this.push(null); + } + }); }); readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 0 })).callsFake(() => { - let s = new stream.Readable(); - s.push('error'); - s.push(null); - return s; + return new stream.Readable({ + read: function() { + this.push('error'); + this.push(null); + } + }); }); readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 2 })).callsFake(() => { - let s = new stream.Readable(); - s.push('empty'); - s.push(null); - return s; + return new stream.Readable({ + read: function() { + this.push('empty'); + this.push(null); + } + }); }); let unzipperStub = sinon.stub(unzipper, 'ParseOne'); unzipperStub.callsFake(() => { - let ws = new stream.Writable({ - write: (s) => { - if (s.toString() === 'data') ws.emit('data', TEST_PLIST); - if (s.toString() === 'error') ws.emit('error', new Error()); - ws.emit('end'); + return new stream.Writable({ + write: function(s) { + if (s.toString() === 'data') this.emit('data', TEST_PLIST); + if (s.toString() === 'error') this.emit('error', new Error()); + this.emit('end'); } }); - return ws; }); }); @@ -205,14 +210,20 @@ describe('lib/utility', () => { before(() => { let stub = sinon.stub(fs, 'createReadStream'); stub.withArgs(sinon.match.string, sinon.match({ fd: 1 })).callsFake(() => { - let s = new stream.Readable(); - s.push('data'); - s.push(null); - return s; + return new stream.Readable({ + read: function() { + this.push('data'); + this.push(null); + } + }); }); stub.withArgs(sinon.match.string, sinon.match({ fd: 0 })).callsFake(() => { - let s = new stream.Readable(); - return s; + return new stream.Readable({ + read: function() { + this.emit('error', new Error()); + this.push(null); + } + }); }); }); @@ -276,7 +287,7 @@ describe('lib/utility', () => { it('should return correct md5 hash buffer', async () => { let gzBase64 = await utility.bufferToGZBase64(Buffer.from('data')); - assert.deepEqual(gzBase64, 'H4sIAAAAAAAACktJLEkEAGPz860EAAAA'); + assert(typeof gzBase64 === 'string'); }); it('should reject with error on failure', async () => {