Skip to content

Commit

Permalink
Merge branch 'release/5.3.3' into release/5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-a-calles-mba committed Jun 13, 2020
2 parents 7c47d9c + 3461c51 commit 20d79c5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
8 changes: 6 additions & 2 deletions lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ module.exports = {
_.merge(entries, entry);
} else {
_.forEach(functions, (func, index) => {
const entry = getEntryForFunction.call(this, functions[index], this.serverless.service.getFunction(func));
_.merge(entries, entry);
const loadedFunc = this.serverless.service.getFunction(func);
const runtime = loadedFunc.runtime || this.serverless.service.provider.runtime;
if (runtime.match(/^node/)) {
const entry = getEntryForFunction.call(this, functions[index], loadedFunc);
_.merge(entries, entry);
}
});
}

Expand Down
31 changes: 25 additions & 6 deletions tests/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ describe('validate', () => {
path: 'func1path'
}
}
]
],
runtime: 'node10.x'
},
func2: {
handler: 'module2.func2handler',
Expand All @@ -437,7 +438,8 @@ describe('validate', () => {
{
nonhttp: 'non-http'
}
]
],
runtime: 'node10.x'
},
func3: {
handler: 'handlers/func3/module2.func3handler',
Expand All @@ -446,7 +448,8 @@ describe('validate', () => {
{
nonhttp: 'non-http'
}
]
],
runtime: 'node10.x'
},
func4: {
handler: 'handlers/module2/func3/module2.func3handler',
Expand All @@ -455,7 +458,18 @@ describe('validate', () => {
{
nonhttp: 'non-http'
}
]
],
runtime: 'node10.x'
},
func5: {
handler: 'com.serverless.Handler',
artifact: 'target/hello-dev.jar',
events: [
{
nonhttp: 'non-http'
}
],
runtime: 'java8'
}
};

Expand All @@ -469,19 +483,24 @@ describe('validate', () => {
path: 'func1path'
}
}
]
],
runtime: 'node10.x'
}
};

it('should expose all functions if `options.function` is not defined', () => {
it('should expose all node functions if `options.function` is not defined', () => {
const testOutPath = 'test';
const testConfig = {
entry: 'test',
context: 'testcontext',
output: {
path: testOutPath
},
getFunction: func => {
return testFunctionsConfig[func];
}
};

_.set(module.serverless.service, 'custom.webpack.config', testConfig);
module.serverless.service.functions = testFunctionsConfig;
globSyncStub.callsFake(filename => [_.replace(filename, '*', 'js')]);
Expand Down

0 comments on commit 20d79c5

Please sign in to comment.