nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: motdotla/node-lambda
Pull request #337 (2017-06-27 06:33:56)

Add simple context method
#293


Patch:
diff --git a/lib/main.js b/lib/main.js
index 3204c7e..35bbe47 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -97,6 +97,16 @@ Lambda.prototype._runHandler = (handler, event, program, context) => {
     return timeout - (currentTime - startTime)
   }
 
+  // The following three functions are deprecated in AWS Lambda.
+  // Since it is sometimes used by other SDK,
+  // it is a simple one that does not result in `not function` error
+  context.succeed = (result) => console.log(JSON.stringify(result))
+  context.fail = (error) => console.log(JSON.stringify(error))
+  context.done = (error, results) => {
+    console.log(JSON.stringify(error))
+    console.log(JSON.stringify(results))
+  }
+
   handler(event, context, callback)
 }
 


Test patch:
diff --git a/test/main.js b/test/main.js
index ad09bd1..ad42cc1 100644
--- a/test/main.js
+++ b/test/main.js
@@ -135,6 +135,18 @@ describe('lib/main', function () {
     })
   })
 
+  describe('_runHandler', () => {
+    it('context methods is a function', (done) => {
+      const handler = (event, context, callback) => {
+        assert.isFunction(context.succeed)
+        assert.isFunction(context.fail)
+        assert.isFunction(context.done)
+        done()
+      }
+      lambda._runHandler(handler, {}, program, {})
+    })
+  })
+
   describe('_params', function () {
     // http://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-FunctionName
     const functionNamePattern =
Repository: motdotla/node-lambda
Pull request #346 (2017-07-05 08:34:37)

Fix to set boolean in params.Publish
#345


Patch:
diff --git a/bin/node-lambda b/bin/node-lambda
index 4dd4532..372208c 100755
--- a/bin/node-lambda
+++ b/bin/node-lambda
@@ -107,8 +107,7 @@ program
     AWS_ENVIRONMENT)
   .option('-x, --excludeGlobs [' + EXCLUDE_GLOBS + ']',
     'Space-separated glob pattern(s) for additional exclude files (e.g. "event.json dotenv.sample")', EXCLUDE_GLOBS)
-  .option('-f, --configFile [' + CONFIG_FILE + ']',
-    'Path to file holding secret environment variables (e.g. "deploy.env")', CONFIG_FILE)
+  .option('-f, --configFile [' + CONFIG_FILE + ']', '!!! Deprecated option in package command !!!', CONFIG_FILE)
   .option('-D, --prebuiltDirectory [' + PREBUILT_DIRECTORY + ']', 'Prebuilt directory', PREBUILT_DIRECTORY)
   .action((prg) => lambda.package(prg))
 
diff --git a/lib/main.js b/lib/main.js
index ade00b3..7150236 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -163,7 +163,12 @@ Lambda.prototype._params = (program, buffer) => {
     Description: program.description,
     MemorySize: program.memorySize,
     Timeout: program.timeout,
-    Publish: program.publish,
+    Publish: (() => {
+      if (typeof program.publish === 'boolean') {
+        return program.publish
+      }
+      return program.publish === 'true'
+    })(),
     VpcConfig: {
       SubnetIds: [],
       SecurityGroupIds: []
@@ -689,6 +694,9 @@ Lambda.prototype._updateScheduleEvents = (scheduleEvents, functionArn, scheduleL
 }
 
 Lambda.prototype.package = function (program) {
+  if (program.configFile) {
+    console.warn('[Warning] -f, --configFile option of the `package` command is deprecated.')
+  }
   const _this = this
   if (!program.packageDirectory) {
     throw new Error('packageDirectory not specified!')


Test patch:
diff --git a/test/main.js b/test/main.js
index 5eaa261..74623dd 100644
--- a/test/main.js
+++ b/test/main.js
@@ -222,6 +222,35 @@ describe('lib/main', function () {
       assert.isNull(params.TracingConfig.Mode)
     })
 
+    describe('params.Publish', () => {
+      describe('boolean', () => {
+        it('If true, it is set to true', () => {
+          program.publish = true
+          const params = lambda._params(program)
+          assert.isTrue(params.Publish)
+        })
+        it('If false, it is set to false', () => {
+          program.publish = false
+          const params = lambda._params(program)
+          assert.isFalse(params.Publish)
+        })
+      })
+
+      describe('string', () => {
+        it('If "true", it is set to true', () => {
+          program.publish = 'true'
+          const params = lambda._params(program)
+          assert.isTrue(params.Publish)
+        })
+        it('If not "true", it is set to false', () => {
+          program.publish = 'false'
+          assert.isFalse(lambda._params(program).Publish)
+          program.publish = 'aaa'
+          assert.isFalse(lambda._params(program).Publish)
+        })
+      })
+    })
+
     describe('configFile', () => {
       beforeEach(() => {
         // Prep...
Repository: motdotla/node-lambda
Pull request #347 (2017-07-05 12:15:10)

bump to 0.11.2
## [0.11.2] - 2017-07-05
### Features
- Fix to deprecated the `configFile` option in the `pacakage` command [#344](https://github.com/motdotla/node-lambda/pull/344)

### Bugfixes
- Fix to set boolean in params.Publish [#346](https://github.com/motdotla/node-lambda/pull/346)



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b849c3e..23c718e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -240,3 +240,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 - Update package-lock.json [#328](https://github.com/motdotla/node-lambda/pull/328)
 - Remove `_rsync` [#329](https://github.com/motdotla/node-lambda/pull/329)
 - Bugfixed that mode of file changes when zip is created [#335](https://github.com/motdotla/node-lambda/pull/335)
+
+## [0.11.2] - 2017-07-05
+### Features
+- Fix to deprecated the `configFile` option in the `pacakage` command [#344](https://github.com/motdotla/node-lambda/pull/344)
+
+### Bugfixes
+- Fix to set boolean in params.Publish [#346](https://github.com/motdotla/node-lambda/pull/346)
diff --git a/package.json b/package.json
index e62e258..ff90f23 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "node-lambda",
-  "version": "0.11.1",
+  "version": "0.11.2",
   "description": "Command line tool for locally running and remotely deploying your node.js applications to Amazon Lambda.",
   "main": "lib/main.js",
   "directories": {


Test patch:
diff --git a/test/main.js b/test/main.js
index 74623dd..0235649 100644
--- a/test/main.js
+++ b/test/main.js
@@ -126,7 +126,7 @@ describe('lib/main', function () {
   })
 
   it('version should be set', () => {
-    assert.equal(lambda.version, '0.11.1')
+    assert.equal(lambda.version, '0.11.2')
   })
 
   describe('_codeDirectory', () => {
Repository: motdotla/node-lambda
Pull request #349 (2017-07-07 08:07:51)

bump to 0.11.3
## [0.11.3] - 2017-07-07
### Features
- Fix symlink at zip [#348](https://github.com/motdotla/node-lambda/pull/348)



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23c718e..0373880 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -247,3 +247,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 ### Bugfixes
 - Fix to set boolean in params.Publish [#346](https://github.com/motdotla/node-lambda/pull/346)
+
+## [0.11.3] - 2017-07-07
+### Features
+- Fix symlink at zip [#348](https://github.com/motdotla/node-lambda/pull/348)
diff --git a/package.json b/package.json
index 0b3c2aa..70efffa 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "node-lambda",
-  "version": "0.11.2",
+  "version": "0.11.3",
   "description": "Command line tool for locally running and remotely deploying your node.js applications to Amazon Lambda.",
   "main": "lib/main.js",
   "directories": {


Test patch:
diff --git a/test/main.js b/test/main.js
index b23a673..7239c5f 100644
--- a/test/main.js
+++ b/test/main.js
@@ -126,7 +126,7 @@ describe('lib/main', function () {
   })
 
   it('version should be set', () => {
-    assert.equal(lambda.version, '0.11.2')
+    assert.equal(lambda.version, '0.11.3')
   })
 
   describe('_codeDirectory', () => {
Repository: motdotla/node-lambda
Pull request #368 (2017-08-10 04:39:18)

Fix commandline version option
Version is displayed with the following command.
```
% node-lambda --version
0.11.3
```

It was an error before modification.
```
% node-lambda --version

  error: unknown option `--version'

```


Patch:
diff --git a/bin/node-lambda b/bin/node-lambda
index 14945cf..5cb588a 100755
--- a/bin/node-lambda
+++ b/bin/node-lambda
@@ -57,7 +57,6 @@ const PROXY = process.env.PROXY || process.env.http_proxy || ''
 
 program
   .command('deploy')
-  .version(lambda.version)
   .description('Deploy your application to Amazon Lambda')
   .option('-e, --environment [' + AWS_ENVIRONMENT + ']', 'Choose environment {dev, staging, production}',
     AWS_ENVIRONMENT)
@@ -135,7 +134,9 @@ program
   .option('-x, --contextFile [' + CONTEXT_FILE + ']', 'Context JSON File', CONTEXT_FILE)
   .action((prg) => lambda.setup(prg))
 
-program.parse(process.argv)
+program
+  .version(lambda.version)
+  .parse(process.argv)
 
 if (!process.argv.slice(2).length) {
   program.outputHelp()


Test patch:
diff --git a/test/node-lambda.js b/test/node-lambda.js
index bd99c70..dcabaf3 100644
--- a/test/node-lambda.js
+++ b/test/node-lambda.js
@@ -198,4 +198,12 @@ describe('bin/node-lambda', () => {
       })
     })
   })
+
+  describe('node-lambda --version', () => {
+    const packageJson = require(path.join(__dirname, '..', 'package.json'))
+    it('The current version is displayed', () => {
+      const ret = execSync(`node ${nodeLambdaPath} --version`)
+      assert.equal(ret.toString().trim(), packageJson.version)
+    })
+  })
 })