Skip to content

Commit 373618b

Browse files
authored
Merge pull request #39 from serverless/colorize-execution-id
Colorize executionId
2 parents 772839f + bbb839e commit 373618b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

invoke/lib/invokeFunction.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/* eslint no-use-before-define: 0 */
44

55
const BbPromise = require('bluebird');
6+
const chalk = require('chalk');
67

78
module.exports = {
89
invokeFunction() {
@@ -45,7 +46,7 @@ module.exports = {
4546
};
4647
}
4748

48-
const log = `${res.executionId}: ${res.result}`;
49+
const log = `${chalk.grey(res.executionId)} ${res.result}`;
4950

5051
this.serverless.cli.log(log);
5152

invoke/lib/invokeFunction.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const sinon = require('sinon');
44
const BbPromise = require('bluebird');
5+
const chalk = require('chalk');
56

67
const GoogleProvider = require('../../provider/googleProvider');
78
const GoogleInvoke = require('../googleInvoke');
@@ -130,7 +131,7 @@ describe('InvokeFunction', () => {
130131
};
131132

132133
const expectedOutput =
133-
'wasdqwerty: Foo bar';
134+
`${chalk.grey('wasdqwerty')} Foo bar`;
134135

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

143-
const expectedOutput = 'error: An error occurred while executing your function...';
144+
const expectedOutput =
145+
`${chalk.grey('error')} An error occurred while executing your function...`;
144146

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

0 commit comments

Comments
 (0)