Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion invoke/lib/invokeFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint no-use-before-define: 0 */

const BbPromise = require('bluebird');
const chalk = require('chalk');

module.exports = {
invokeFunction() {
Expand Down Expand Up @@ -45,7 +46,7 @@ module.exports = {
};
}

const log = `${res.executionId}: ${res.result}`;
const log = `${chalk.grey(res.executionId)} ${res.result}`;

this.serverless.cli.log(log);

Expand Down
6 changes: 4 additions & 2 deletions invoke/lib/invokeFunction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const sinon = require('sinon');
const BbPromise = require('bluebird');
const chalk = require('chalk');

const GoogleProvider = require('../../provider/googleProvider');
const GoogleInvoke = require('../googleInvoke');
Expand Down Expand Up @@ -130,7 +131,7 @@ describe('InvokeFunction', () => {
};

const expectedOutput =
'wasdqwerty: Foo bar';
`${chalk.grey('wasdqwerty')} Foo bar`;

return googleInvoke.printResult(result).then(() => {
expect(consoleLogStub.calledWithExactly(expectedOutput)).toEqual(true);
Expand All @@ -140,7 +141,8 @@ describe('InvokeFunction', () => {
it('should print an error message to the console when no result was received', () => {
const result = {};

const expectedOutput = 'error: An error occurred while executing your function...';
const expectedOutput =
`${chalk.grey('error')} An error occurred while executing your function...`;

return googleInvoke.printResult(result).then(() => {
expect(consoleLogStub.calledWithExactly(expectedOutput)).toEqual(true);
Expand Down