fix: Fix packaging logic after regression introduced with #7742 (#7743)

This commit is contained in:
TATSUNO Yasuhiro 2020-05-19 17:22:54 +09:00 committed by GitHub
parent 4252422a94
commit de4aee3f25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View File

@ -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 =>

View File

@ -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);
});