mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Allow services with no functions #2267
This commit is contained in:
parent
dffd13acf4
commit
fd1545d89d
@ -58,9 +58,6 @@ class Service {
|
||||
if (!serverlessFile.provider) {
|
||||
throw new SError('"provider" property is missing in serverless.yml');
|
||||
}
|
||||
if (!serverlessFile.functions) {
|
||||
throw new SError('"functions" property is missing in serverless.yml');
|
||||
}
|
||||
|
||||
if (typeof serverlessFile.provider !== 'object') {
|
||||
const providerName = serverlessFile.provider;
|
||||
@ -84,7 +81,7 @@ class Service {
|
||||
that.custom = serverlessFile.custom;
|
||||
that.plugins = serverlessFile.plugins;
|
||||
that.resources = serverlessFile.resources;
|
||||
that.functions = serverlessFile.functions;
|
||||
that.functions = serverlessFile.functions || {};
|
||||
|
||||
if (serverlessFile.package) {
|
||||
that.package.individually = serverlessFile.package.individually;
|
||||
|
||||
@ -334,7 +334,7 @@ describe('Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw error if functions property is missing', () => {
|
||||
it('should not throw error if functions property is missing', () => {
|
||||
const SUtils = new Utils();
|
||||
const serverlessYml = {
|
||||
service: 'service-name',
|
||||
@ -347,11 +347,7 @@ describe('Service', () => {
|
||||
serviceInstance = new Service(serverless);
|
||||
|
||||
return serviceInstance.load().then(() => {
|
||||
// if we reach this, then no error was thrown as expected
|
||||
// so make assertion fail intentionally to let us know something is wrong
|
||||
expect(1).to.equal(2);
|
||||
}).catch(e => {
|
||||
expect(e.name).to.be.equal('ServerlessError');
|
||||
expect(serverless.service.functions).to.deep.equal({});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user