diff --git a/lib/plugins/aws/deploy/lib/checkForChanges.js b/lib/plugins/aws/deploy/lib/checkForChanges.js index 6bcc53cf9..def3717d7 100644 --- a/lib/plugins/aws/deploy/lib/checkForChanges.js +++ b/lib/plugins/aws/deploy/lib/checkForChanges.js @@ -134,10 +134,9 @@ module.exports = { // create hashes for all the zip files const zipFiles = globby.sync(['**.zip'], { cwd: serverlessDirPath, dot: true, silent: true }); if (this.serverless.service.package.artifact) { - const arficatPath = path.join(serverlessDirPath, this.serverless.service.package.artifact); - zipFiles.push(arficatPath); + zipFiles.push(this.serverless.service.package.artifact); } - const zipFilePaths = zipFiles.map(zipFile => path.join(serverlessDirPath, zipFile)); + const zipFilePaths = zipFiles.map(zipFile => path.resolve(serverlessDirPath, zipFile)); const readFile = BbPromise.promisify(fs.readFile); const zipFileHashesPromises = zipFilePaths.map(zipFilePath => diff --git a/lib/plugins/aws/deploy/lib/checkForChanges.test.js b/lib/plugins/aws/deploy/lib/checkForChanges.test.js index aa21fc171..f0a268bba 100644 --- a/lib/plugins/aws/deploy/lib/checkForChanges.test.js +++ b/lib/plugins/aws/deploy/lib/checkForChanges.test.js @@ -308,7 +308,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); }); @@ -351,7 +351,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); }); @@ -389,7 +389,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); }); @@ -432,8 +432,12 @@ describe('checkForChanges', () => { dot: true, silent: true, }); - expect(readFileStub).to.have.been.calledWith(path.join('my-service/.serverless/func1.zip')); - expect(readFileStub).to.have.been.calledWith(path.join('my-service/.serverless/func2.zip')); + expect(readFileStub).to.have.been.calledWith( + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/func1.zip') + ); + expect(readFileStub).to.have.been.calledWith( + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/func2.zip') + ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); }); }); @@ -474,7 +478,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); }); @@ -512,7 +516,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(true); }); @@ -554,7 +558,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/my-service.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(true); } @@ -599,8 +603,12 @@ describe('checkForChanges', () => { dot: true, silent: true, }); - expect(readFileStub).to.have.been.calledWith(path.join('my-service/.serverless/func1.zip')); - expect(readFileStub).to.have.been.calledWith(path.join('my-service/.serverless/func2.zip')); + expect(readFileStub).to.have.been.calledWith( + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/func1.zip') + ); + expect(readFileStub).to.have.been.calledWith( + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/func2.zip') + ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(true); }); }); @@ -641,7 +649,7 @@ describe('checkForChanges', () => { silent: true, }); expect(readFileStub).to.have.been.calledWith( - path.join('my-service/.serverless/my-service/.serverless/foo/bar/my-own.zip') + path.resolve(awsDeploy.serverless.config.servicePath, '.serverless/foo/bar/my-own.zip') ); expect(awsDeploy.serverless.service.provider.shouldNotDeploy).to.equal(undefined); });