Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ import utils = require('./lib/utils');
console.log("Loading ESCMAScript modules not available on NodeJS < 12.0.0.");
process.exit(1);
}
if (program.watch) {
console.log("Watch mode not supported for ECMAScript lambda modules.");
process.exit(1);
}
}
var event = function(){
if(program.watch) return null;
Expand Down
3 changes: 3 additions & 0 deletions test/functs/test-func-esm-echo.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function handler(event, context) {
context.succeed(event);
}
21 changes: 13 additions & 8 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,14 +590,6 @@ describe("- Testing cli.js", function () {
assert.equal(r.status, 1);
console.log(r.output);
});

it("should fail: esm with unsupported watch mode", function () {
var command = get_shell("node ../build/cli.js -l ./functs/test-func-esm.mjs --esm --watch");
var r = spawnSync(command[0], command[1]);
process_outputs(r);
assert.equal(r.status, 1);
console.log(r.output);
})
});

describe("* Environment test run", function () {
Expand Down Expand Up @@ -673,6 +665,19 @@ describe("- Testing cli.js", function () {
cb
);
});
it("test watch with esm", function (cb) {
var command = get_shell("node ../build/cli.js -l ./functs/test-func-esm-echo.mjs --watch --esm");
var r = spawnAsync(command[0], command[1]);
doRequestWhenReady(r,
{
"hey": "data",
},
(result) => {
assert.deepEqual(result["body"], {"hey": "data"});
},
cb
);
});
});
}

Expand Down