Skip to content

Commit 2621343

Browse files
committed
Add --version support
1 parent babc059 commit 2621343

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import utils = require('./lib/utils');
1515
var program = require('commander');
1616
program
1717
.name('lambda-local')
18+
.version(lambdaLocal.version)
1819
.option('-l, --lambda-path <lambda index path>', '(required) Lambda function file name.')
1920
.option('-e, --event-path <path>', '(required) Event data file name.')
2021
.option('-h, --handler <handler name>',

src/lambdalocal.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import { createServer, IncomingMessage, ServerResponse } from 'http';
1414
import utils = require('./lib/utils.js');
1515
import Context = require('./lib/context.js');
1616

17+
/*
18+
* Lambda local version
19+
*/
20+
export const version = "1.7.3";
21+
1722
var logger = utils.getWinstonConsole();
1823

1924
export function setLogger(_logger){

test/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,4 +560,14 @@ describe("- Testing cli.js", function () {
560560
assert.equal((r.output.indexOf("Timeout finished !") !== -1), true)
561561
});
562562
});
563+
describe("* Test --version", function() {
564+
var lambdalocal = require(lambdalocal_path);
565+
it("should match the current latest version", function() {
566+
var command = get_shell("node ../build/cli.js --version");
567+
var r = spawnSync(command[0], command[1]);
568+
process_outputs(r);
569+
assert.equal(r.status, 0);
570+
assert.equal(r.output.trim(), lambdalocal.version);
571+
});
572+
});
563573
});

0 commit comments

Comments
 (0)