Skip to content

Commit 97b5ec3

Browse files
author
Nick Santos
committed
fix heap space option, and add tests
1 parent 28ee0a4 commit 97b5ec3

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

lib/launch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function launch(options, port) {
4848
]
4949

5050
if (options.heap) {
51-
args.push('-Xmx=' + options.heap)
51+
args.push('-Xmx' + options.heap)
5252
}
5353

5454
args.push(

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
"type": "git",
2424
"url": "https://github.com/Medium/local-dynamo.git"
2525
},
26+
"scripts": {
27+
"test": "./node_modules/.bin/nodeunit test"
28+
},
2629
"dependencies": {
2730
"flags": "0.1.2",
2831
"kew": "0.4.0",
2932
"metrics": "0.1.8",
3033
"progress": "1.1.8"
3134
},
3235
"devDependencies": {
33-
"aws-sdk": "^2.0.22"
36+
"aws-sdk": "^2.0.22",
37+
"nodeunit": "0.9.1"
3438
}
3539
}

test/launch_test.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2015 A Medium Corporation.
2+
3+
var localDynamo = require('../lib/launch')
4+
5+
exports.testMemory = function (test) {
6+
var dynamo = localDynamo.launch({
7+
port: 8676,
8+
heap: '512m'
9+
})
10+
dynamo.stdout.on('data', function (data) {
11+
console.log('stdout', data.toString())
12+
})
13+
dynamo.stderr.on('data', function (data) {
14+
console.log('stderr', data.toString())
15+
})
16+
17+
var finished = false
18+
19+
dynamo.on('exit', function (code) {
20+
if (finished) return
21+
22+
finished = true
23+
test.ok(false, 'Unexpected exit code ' + code)
24+
test.done()
25+
})
26+
27+
// If everything goes well after 5 seconds, then we're done!
28+
setTimeout(function () {
29+
finished = true
30+
dynamo.kill()
31+
test.done()
32+
}, 5000).unref()
33+
}

0 commit comments

Comments
 (0)