From 53525bb9057ff299db1f440d3e185c062079e8de Mon Sep 17 00:00:00 2001 From: abetomo Date: Fri, 19 May 2017 12:57:01 +0900 Subject: [PATCH 1/4] Fix to use '===' instead of '==' (Including similar modifications) --- lib/main.js | 12 ++++++------ lib/schedule_events.js | 2 +- test/main.js | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/main.js b/lib/main.js index 47f63ad3..94d4b546 100644 --- a/lib/main.js +++ b/lib/main.js @@ -87,7 +87,7 @@ Lambda.prototype._runHandler = function (handler, event, program, context) { return timeout - (currentTime - startTime); }; - if (['nodejs4.3', 'nodejs6.10'].indexOf(program.runtime) == -1) { + if (['nodejs4.3', 'nodejs6.10'].indexOf(program.runtime) === -1) { console.error("Runtime [" + program.runtime + "] is not supported."); process.exit(254); } @@ -203,11 +203,11 @@ Lambda.prototype._fileCopy = function (program, src, dest, excludeNodeModules, c // Formatting for `filter` of `fs.copy` const dirBlobs = []; const pattern = '{' + excludes.map(function (str) { - if (str.charAt(str.length - 1) == path.sep) { + if (str.charAt(str.length - 1) === path.sep) { str = str.substr(0, str.length - 1); dirBlobs.push(str); } - if (str.charAt(0) == path.sep) + if (str.charAt(0) === path.sep) return path.join(srcAbsolutePath, str); if (str.indexOf(path.sep) >= 0) return path.join(path.resolve('/**'), str); @@ -452,7 +452,7 @@ Lambda.prototype._archivePrebuilt = function (program, archiveCallback) { // (Used if there is a problem with `_ fileCopy`) // If there is no problem even if deleting `_rsync`, this switching process is deleted var copyFunction = '_fileCopy'; - if (process.env.NODE_LAMBDA_COPY_FUNCTION == 'rsync') { + if (process.env.NODE_LAMBDA_COPY_FUNCTION === 'rsync') { console.log('=> INFO: Use rsync for copy'); copyFunction = '_rsync'; } @@ -494,7 +494,7 @@ Lambda.prototype._buildAndArchive = function (program, archiveCallback) { // (Used if there is a problem with `_ fileCopy`) // If there is no problem even if deleting `_rsync`, this switching process is deleted var copyFunction = '_fileCopy'; - if (process.env.NODE_LAMBDA_COPY_FUNCTION == 'rsync') { + if (process.env.NODE_LAMBDA_COPY_FUNCTION === 'rsync') { console.log('=> INFO: Use rsync for copy'); copyFunction = '_rsync'; } @@ -782,7 +782,7 @@ Lambda.prototype.deploy = function (program) { return result.filter(function(res) { return res.length > 0; }).length > 0; - }).length == 0; + }).length === 0; if (!resultsIsEmpty) { console.log('=> All tasks done. Results follow: '); console.log(JSON.stringify(results, null, ' ')); diff --git a/lib/schedule_events.js b/lib/schedule_events.js index a204a04e..b9edab89 100644 --- a/lib/schedule_events.js +++ b/lib/schedule_events.js @@ -60,7 +60,7 @@ ScheduleEvents.prototype = { const _params = _this._addPermissionParams(params); _this.lambda.addPermission(_params, (err, data) => { if (err) { - if (err.code != 'ResourceConflictException') throw err; + if (err.code !== 'ResourceConflictException') throw err; // If it exists it will result in an error but there is no problem. resolve('Already exists permission'); } diff --git a/test/main.js b/test/main.js index 1aa02b55..9e429feb 100644 --- a/test/main.js +++ b/test/main.js @@ -40,13 +40,13 @@ function _timeout(params) { // Even if timeout is set for the whole test for Windows, // if it is set in local it will be valid. // For Windows, do not set it with local. - if (process.platform != 'win32') { + if (process.platform !== 'win32') { params.this.timeout(params.sec * 1000); } } describe('lib/main', function () { - if (process.platform == 'win32') { + if (process.platform === 'win32') { // It seems that it takes time for file operation in Windows. // So set `timeout(60000)` for the whole test. this.timeout(60000); @@ -272,7 +272,7 @@ describe('lib/main', function () { assert.notInclude(contents, 'fuga', 'Target: "__unittest/fuga"'); contents = fs.readdirSync(path.join(codeDirectory, '__unittest', 'hoge')); - assert.isTrue(contents.length == 0, 'directory:__unittest/hoge is empty'); + assert.equal(contents.length, 0, 'directory:__unittest/hoge is empty'); done(); }); }); @@ -309,7 +309,7 @@ describe('lib/main', function () { } describe('_fileCopy', function() { rsyncTests('_fileCopy'); }); - if (process.platform == 'win32') { + if (process.platform === 'win32') { it('For Windows, `_rsync` tests pending'); } else { describe('_rsync', function() { rsyncTests('_rsync'); }); @@ -343,7 +343,7 @@ describe('lib/main', function () { }); describe('_postInstallScript', function () { - if (process.platform == 'win32') { + if (process.platform === 'win32') { return it('`_postInstallScript` test does not support Windows.'); } From 1b4905663a50da86ba4ea908baa64c01ba2770d0 Mon Sep 17 00:00:00 2001 From: abetomo Date: Mon, 22 May 2017 13:50:43 +0900 Subject: [PATCH 2/4] Fix using strings for single quotes --- lib/main.js | 6 +++--- test/main.js | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/main.js b/lib/main.js index 3f2a927f..0b973a96 100644 --- a/lib/main.js +++ b/lib/main.js @@ -87,7 +87,7 @@ Lambda.prototype._runHandler = function (handler, event, program, context) { }; if (['nodejs4.3', 'nodejs6.10'].indexOf(program.runtime) === -1) { - console.error("Runtime [" + program.runtime + "] is not supported."); + console.error(`Runtime [${program.runtime}] is not supported.`); process.exit(254); } handler(event, context, callback); @@ -317,9 +317,9 @@ Lambda.prototype._postInstallScript = function (program, codeDirectory, callback maxBuffer: maxBufferSize }, function (error, stdout, stderr) { if (error) { - return callback(error + " stdout: " + stdout + " stderr: " + stderr); + return callback(error + ' stdout: ' + stdout + ' stderr: ' + stderr); } - console.log("\t\t" + stdout); + console.log('\t\t' + stdout); callback(null); }); }; diff --git a/test/main.js b/test/main.js index 9e429feb..555f1abd 100644 --- a/test/main.js +++ b/test/main.js @@ -156,8 +156,8 @@ describe('lib/main', function () { it('adds variables when configFile param is set', function () { program.configFile = 'tmp.env'; var params = lambda._params(program); - assert.equal(params.Environment.Variables['FOO'], "bar"); - assert.equal(params.Environment.Variables['BAZ'], "bing"); + assert.equal(params.Environment.Variables['FOO'], 'bar'); + assert.equal(params.Environment.Variables['BAZ'], 'bing'); }); it('when configFile param is set but it is an empty file', function () { @@ -398,7 +398,10 @@ describe('lib/main', function () { fs.chmodSync(path.join(codeDirectory, 'post_install.sh'), '755'); lambda._postInstallScript(program, codeDirectory, function (err) { assert.isNull(err); - assert.equal("=> Running post install script post_install.sh\n\t\tYour environment is "+program.environment+"\n", hook.captured()); + assert.equal( + `=> Running post install script post_install.sh\n\t\tYour environment is ${program.environment}\n`, + hook.captured() + ); done(); }); }); From b3971cf74f7fa63eae31e37fc1acafea5f1d2415 Mon Sep 17 00:00:00 2001 From: abetomo Date: Mon, 22 May 2017 13:57:52 +0900 Subject: [PATCH 3/4] Fix using let Fix for not being careful with `VARIABLE is already defined` in JavaScript Standard Style --- lib/main.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/main.js b/lib/main.js index 0b973a96..60f4203a 100644 --- a/lib/main.js +++ b/lib/main.js @@ -369,7 +369,7 @@ Lambda.prototype._setRunTimeEnvironmentVars = function (program) { var configValues = fs.readFileSync(program.configFile); var config = dotenv.parse(configValues); - for (var k in config) { + for (let k in config) { if (!config.hasOwnProperty(k)) { continue; } @@ -537,9 +537,9 @@ Lambda.prototype._updateEventSources = function (lambda, functionName, existingE } var updateEventSourceList = []; // Checking new and update event sources - for (var i in eventSourceList) { - var isExisting = false; - for (var j in existingEventSourceList) { + for (let i in eventSourceList) { + let isExisting = false; + for (let j in existingEventSourceList) { if (eventSourceList[i]['EventSourceArn'] === existingEventSourceList[j]['EventSourceArn']) { isExisting = true; updateEventSourceList.push({ @@ -567,9 +567,9 @@ Lambda.prototype._updateEventSources = function (lambda, functionName, existingE } // Checking delete event sources - for (var i in existingEventSourceList) { - var isExisting = false; - for (var j in eventSourceList) { + for (let i in existingEventSourceList) { + let isExisting = false; + for (let j in eventSourceList) { if (eventSourceList[j]['EventSourceArn'] === existingEventSourceList[i]['EventSourceArn']) { isExisting = true; break; From 5a044810d8db92b8a8d37dfb9aae4d5cfcf34ed1 Mon Sep 17 00:00:00 2001 From: abetomo Date: Mon, 22 May 2017 14:09:49 +0900 Subject: [PATCH 4/4] Add space and format the code Fix to prevent the message like the following from being displayed - Missing space before function parentheses. - Missing space before opening brace. --- index.js | 2 +- lib/main.js | 40 +++++++++++++------------- lib/schedule_events.js | 16 +++++------ test/main.js | 62 ++++++++++++++++++++--------------------- test/schedule_events.js | 2 +- 5 files changed, 61 insertions(+), 61 deletions(-) diff --git a/index.js b/index.js index c849218c..6d2e1394 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ // For development/testing purposes -exports.handler = function(event, context, callback) { +exports.handler = function (event, context, callback) { console.log('Running index.handler'); console.log('=================================='); console.log('event', event); diff --git a/lib/main.js b/lib/main.js index 60f4203a..5c4d32ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -159,7 +159,7 @@ Lambda.prototype._eventSourceList = function (program) { ScheduleEvents: null }; } - const list = (function() { + const list = (function () { try { return fs.readJsonSync(program.eventSourceFile); } catch(err) { @@ -606,7 +606,7 @@ Lambda.prototype._updateEventSources = function (lambda, functionName, existingE }); break; } - }, function(err, results) { + }, function (err, results) { return cb(err, results); }); }; @@ -615,8 +615,8 @@ Lambda.prototype._updateScheduleEvents = function (scheduleEvents, functionArn, if (scheduleList == null) { return cb(null, []); } - return async.series(scheduleList.map(function(schedule) { - return function(_cb) { + return async.series(scheduleList.map(function (schedule) { + return function (_cb) { const params = Object.assign(schedule, { FunctionArn: functionArn }); scheduleEvents.add(params).then(function (data) { _cb(null, params); @@ -624,7 +624,7 @@ Lambda.prototype._updateScheduleEvents = function (scheduleEvents, functionArn, _cb(err); }); }; - }), function(err, results) { + }), function (err, results) { cb(err, results); }); }; @@ -718,7 +718,7 @@ Lambda.prototype.deploy = function (program) { }, function (err) { if (err) { // Function does not exist - return _this._uploadNew(lambda, params, function(err, results) { + return _this._uploadNew(lambda, params, function (err, results) { if (err) { throw err; } @@ -726,18 +726,18 @@ Lambda.prototype.deploy = function (program) { console.log(results); async.parallel([ - function(_callback) { + function (_callback) { // Updating event source(s) - _this._updateEventSources(lambda, params.FunctionName, [], eventSourceList.EventSourceMappings, function(err, results) { + _this._updateEventSources(lambda, params.FunctionName, [], eventSourceList.EventSourceMappings, function (err, results) { _callback(null, results); }); }, - function(_callback) { - _this._updateScheduleEvents(scheduleEvents, results.FunctionArn, eventSourceList.ScheduleEvents, function(err, results) { + function (_callback) { + _this._updateScheduleEvents(scheduleEvents, results.FunctionArn, eventSourceList.ScheduleEvents, function (err, results) { _callback(err, results); }); } - ], function(err, results) { + ], function (err, results) { cb(err, results); }); }); @@ -746,29 +746,29 @@ Lambda.prototype.deploy = function (program) { // Function exists _this._listEventSourceMappings(lambda, { 'FunctionName': params.FunctionName - }, function(err, existingEventSourceList) { + }, function (err, existingEventSourceList) { if (err) { throw err; } return async.parallel([ - function(_callback) { - _this._uploadExisting(lambda, params, function(err, results) { + function (_callback) { + _this._uploadExisting(lambda, params, function (err, results) { if (err) { throw err; } console.log('=> Zip file(s) done uploading. Results follow: '); console.log(results); - _this._updateScheduleEvents(scheduleEvents, results.FunctionArn, eventSourceList.ScheduleEvents, function(err, results) { + _this._updateScheduleEvents(scheduleEvents, results.FunctionArn, eventSourceList.ScheduleEvents, function (err, results) { _callback(err, results); }); }); }, - function(_callback) { - _this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList.EventSourceMappings, function(err, results) { + function (_callback) { + _this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList.EventSourceMappings, function (err, results) { _callback(err, results); }); } - ], function(err, results) { + ], function (err, results) { cb(err, results); }); }); @@ -777,8 +777,8 @@ Lambda.prototype.deploy = function (program) { if (err) { throw err; } - const resultsIsEmpty = results.filter(function(result) { - return result.filter(function(res) { + const resultsIsEmpty = results.filter(function (result) { + return result.filter(function (res) { return res.length > 0; }).length > 0; }).length === 0; diff --git a/lib/schedule_events.js b/lib/schedule_events.js index b9edab89..835f3c9b 100644 --- a/lib/schedule_events.js +++ b/lib/schedule_events.js @@ -1,6 +1,6 @@ 'use strict'; -const ScheduleEvents = function(aws) { +const ScheduleEvents = function (aws) { // Authenticated `aws` object in `lib/main.js` this.lambda = new aws.Lambda({ apiVersion: '2015-03-31' @@ -23,7 +23,7 @@ ScheduleEvents.prototype = { return params.FunctionArn.split(':').pop(); }, - _putRulePrams: function(params) { + _putRulePrams: function (params) { return { Name: params.ScheduleName, Description: this._ruleDescription(params), @@ -32,7 +32,7 @@ ScheduleEvents.prototype = { }; }, - _putRule: function(params) { + _putRule: function (params) { const _this = this; // return RuleArn if created return new Promise((resolve) => { @@ -44,7 +44,7 @@ ScheduleEvents.prototype = { }); }, - _addPermissionParams: function(params) { + _addPermissionParams: function (params) { return { Action: 'lambda:InvokeFunction', FunctionName: this._functionName(params), @@ -54,7 +54,7 @@ ScheduleEvents.prototype = { }; }, - _addPermission: function(params) { + _addPermission: function (params) { const _this = this; return new Promise((resolve) => { const _params = _this._addPermissionParams(params); @@ -69,7 +69,7 @@ ScheduleEvents.prototype = { }); }, - _putTargetsParams: function(params) { + _putTargetsParams: function (params) { return { Rule: params.ScheduleName, Targets: [{ @@ -79,7 +79,7 @@ ScheduleEvents.prototype = { }; }, - _putTargets: function(params) { + _putTargets: function (params) { const _this = this; return new Promise((resolve) => { const _params = _this._putTargetsParams(params); @@ -91,7 +91,7 @@ ScheduleEvents.prototype = { }); }, - add: function(params) { + add: function (params) { const _this = this; return Promise.resolve().then(() => { return _this._putRule(params); diff --git a/test/main.js b/test/main.js index 555f1abd..11dfcf95 100644 --- a/test/main.js +++ b/test/main.js @@ -36,7 +36,7 @@ var originalProgram = { var codeDirectory = lambda._codeDirectory(); -function _timeout(params) { +function _timeout (params) { // Even if timeout is set for the whole test for Windows, // if it is set in local it will be valid. // For Windows, do not set it with local. @@ -97,7 +97,7 @@ describe('lib/main', function () { assert.match(params.FunctionName, functionNamePattern); }); - it('appends VpcConfig to params when vpc params set', function() { + it('appends VpcConfig to params when vpc params set', function () { program.vpcSubnets = 'subnet-00000000,subnet-00000001,subnet-00000002'; program.vpcSecurityGroups = 'sg-00000000,sg-00000001,sg-00000002'; var params = lambda._params(program); @@ -109,33 +109,33 @@ describe('lib/main', function () { assert.equal(params.VpcConfig.SecurityGroupIds[2], program.vpcSecurityGroups.split(',')[2]); }); - it('does not append VpcConfig when params are not set', function() { + it('does not append VpcConfig when params are not set', function () { var params = lambda._params(program); assert.equal(Object.keys(params.VpcConfig.SubnetIds).length, 0); assert.equal(Object.keys(params.VpcConfig.SecurityGroupIds).length, 0); }); - it('appends DeadLetterConfig to params when DLQ params set', function() { - ['', 'arn:aws:sqs:test'].forEach(function(v) { + it('appends DeadLetterConfig to params when DLQ params set', function () { + ['', 'arn:aws:sqs:test'].forEach(function (v) { program.deadLetterConfigTargetArn = v; const params = lambda._params(program); assert.equal(params.DeadLetterConfig.TargetArn, v, v); }); }); - it('does not append DeadLetterConfig when params are not set', function() { + it('does not append DeadLetterConfig when params are not set', function () { delete program.deadLetterConfigTargetArn; var params = lambda._params(program); assert.isNull(params.DeadLetterConfig.TargetArn); }); - it('appends TracingConfig to params when params set', function() { + it('appends TracingConfig to params when params set', function () { program.tracingConfig = 'Active'; const params = lambda._params(program); assert.equal(params.TracingConfig.Mode, 'Active'); }); - it('does not append TracingConfig when params are not set', function() { + it('does not append TracingConfig when params are not set', function () { program.tracingConfig = ''; const params = lambda._params(program); assert.isNull(params.TracingConfig.Mode); @@ -197,7 +197,7 @@ describe('lib/main', function () { }); }); - function rsyncTests(funcName) { + function rsyncTests (funcName) { before(function () { fs.mkdirSync('build'); fs.mkdirsSync(path.join('__unittest', 'hoge')); @@ -279,7 +279,7 @@ describe('lib/main', function () { it(funcName + ' should not exclude package.json, even when excluded by excludeGlobs', function (done) { program.excludeGlobs = '*.json'; - lambda[funcName](program, '.', codeDirectory, true, function(err, result) { + lambda[funcName](program, '.', codeDirectory, true, function (err, result) { var contents = fs.readdirSync(codeDirectory); assert.include(contents, 'package.json'); done(); @@ -288,7 +288,7 @@ describe('lib/main', function () { it(funcName + ' should not include package.json when --prebuiltDirectory is set', function (done) { var buildDir = '.build_' + Date.now(); - after(function() { + after(function () { rimraf.sync(buildDir, fs); }); @@ -298,7 +298,7 @@ describe('lib/main', function () { program.excludeGlobs = '*.json'; program.prebuiltDirectory = buildDir; - lambda[funcName](program, buildDir, codeDirectory, true, function(err, result) { + lambda[funcName](program, buildDir, codeDirectory, true, function (err, result) { var contents = fs.readdirSync(codeDirectory); assert.notInclude(contents, 'package.json', 'Target: "packages.json"'); assert.include(contents, 'testa', 'Target: "testa"'); @@ -308,11 +308,11 @@ describe('lib/main', function () { }); } - describe('_fileCopy', function() { rsyncTests('_fileCopy'); }); + describe('_fileCopy', function () { rsyncTests('_fileCopy'); }); if (process.platform === 'win32') { it('For Windows, `_rsync` tests pending'); } else { - describe('_rsync', function() { rsyncTests('_rsync'); }); + describe('_rsync', function () { rsyncTests('_rsync'); }); } describe('_npmInstall', function () { @@ -352,27 +352,27 @@ describe('lib/main', function () { /** * Capture console output */ - function captureStream(stream){ + function captureStream (stream) { var oldWrite = stream.write; var buf = ''; - stream.write = function(chunk, encoding, callback){ + stream.write = function (chunk, encoding, callback) { buf += chunk.toString(); // chunk is a String or Buffer oldWrite.apply(stream, arguments); } return { - unhook: function unhook(){ + unhook: function unhook () { stream.write = oldWrite; }, - captured: function(){ + captured: function () { return buf; } }; } - beforeEach(function(){ + beforeEach(function () { hook = captureStream(process.stdout); }); - afterEach(function(){ + afterEach(function () { hook.unhook(); if (fs.existsSync(postInstallScriptPath)) fs.unlinkSync(postInstallScriptPath); @@ -461,7 +461,7 @@ describe('lib/main', function () { it('packages a prebuilt module without installing', function (done) { _timeout({ this: this, sec: 30 }); // give it time to zip var buildDir = '.build_' + Date.now(); - after(function() { + after(function () { rimraf.sync(buildDir, fs); }); @@ -493,7 +493,7 @@ describe('lib/main', function () { describe('_readArchive', function () { const testZipFile = path.join(os.tmpdir(), 'node-lambda-test.zip'); var bufferExpected = null; - before(function(done) { + before(function (done) { _timeout({ this: this, sec: 30 }); // give it time to zip lambda._zip(program, codeDirectory, function (err, data) { @@ -503,7 +503,7 @@ describe('lib/main', function () { }); }); - after(function() { + after(function () { fs.unlinkSync(testZipFile); }); @@ -597,7 +597,7 @@ describe('lib/main', function () { ]; after(function () { - targetFiles.forEach(function(file) { + targetFiles.forEach(function (file) { fs.unlinkSync(file); }); program.eventSourceFile = ''; @@ -607,7 +607,7 @@ describe('lib/main', function () { lambda.setup(program); const libPath = path.join(__dirname, '..', 'lib'); - targetFiles.forEach(function(targetFile) { + targetFiles.forEach(function (targetFile) { const boilerplateFile = path.join(libPath, `${targetFile}.example`); assert.equal( @@ -637,7 +637,7 @@ describe('lib/main', function () { ); }); - describe('program.eventSourceFile is valid value', function() { + describe('program.eventSourceFile is valid value', function () { before(function () { fs.writeFileSync('only_EventSourceMappings.json', JSON.stringify({ EventSourceMappings: [{ test: 1 }] @@ -723,7 +723,7 @@ describe('lib/main', function () { program.eventSourceFile = ''; const eventSourceList = lambda._eventSourceList(program); return new Promise(function (resolve) { - lambda._updateEventSources(lambda, '', [], eventSourceList.EventSourceMappings, function(err, results) { + lambda._updateEventSources(lambda, '', [], eventSourceList.EventSourceMappings, function (err, results) { resolve({ err: err, results: results }); }); }).then(function (actual) { @@ -776,7 +776,7 @@ describe('lib/main', function () { program.eventSourceFile = ''; const eventSourceList = lambda._eventSourceList(program); return new Promise(function (resolve) { - lambda._updateScheduleEvents(schedule, '', eventSourceList.ScheduleEvents, function(err, results) { + lambda._updateScheduleEvents(schedule, '', eventSourceList.ScheduleEvents, function (err, results) { resolve({ err: err, results: results }); }); }).then(function (actual) { @@ -790,7 +790,7 @@ describe('lib/main', function () { const eventSourceList = lambda._eventSourceList(program); const functionArn = 'arn:aws:lambda:us-west-2:XXX:function:node-lambda-test-function'; return new Promise(function (resolve) { - lambda._updateScheduleEvents(schedule, functionArn, eventSourceList.ScheduleEvents, function(err, results) { + lambda._updateScheduleEvents(schedule, functionArn, eventSourceList.ScheduleEvents, function (err, results) { resolve({ err: err, results: results }); }); }).then(function (actual) { @@ -821,7 +821,7 @@ describe('lib/main', function () { afterEach(function () { fs.unlinkSync('newContext.json'); fs.unlinkSync('newEvent.json'); - filesCreatedBySetup.forEach(function(file) { + filesCreatedBySetup.forEach(function (file) { fs.unlinkSync(file); }); }); @@ -836,7 +836,7 @@ describe('lib/main', function () { assert.equal(fs.readFileSync('newEvent.json').toString(), '{"FOO"="bar"}'); const libPath = path.join(__dirname, '..', 'lib'); - filesCreatedBySetup.forEach(function(targetFile) { + filesCreatedBySetup.forEach(function (targetFile) { const boilerplateFile = path.join(libPath, `${targetFile}.example`); assert.equal( diff --git a/test/schedule_events.js b/test/schedule_events.js index 7806009a..7e3f3985 100644 --- a/test/schedule_events.js +++ b/test/schedule_events.js @@ -103,7 +103,7 @@ describe('lib/schedule_events', () => { describe('_addPermissionParams', () => { it('correct value', () => { const expected = { - Action:'lambda:InvokeFunction', + Action: 'lambda:InvokeFunction', FunctionName: 'node-lambda-test-function', Principal: 'events.amazonaws.com', SourceArn: 'arn:aws:events:hoge:fuga',