Ensure to not wait for stdin when testing

This commit is contained in:
Mariusz Nowak 2019-05-16 10:07:20 +02:00
parent 2d99d7f082
commit 8fcfee6168
No known key found for this signature in database
GPG Key ID: AA6F4CCD415BF299

View File

@ -51,6 +51,7 @@ describe('AwsInvoke', () => {
});
describe('#extendedValidate()', () => {
let backupIsTTY;
beforeEach(() => {
serverless.config.servicePath = true;
serverless.service.environment = {
@ -73,6 +74,15 @@ describe('AwsInvoke', () => {
};
awsInvoke.options.data = null;
awsInvoke.options.path = false;
// Ensure there's no attempt to read path from stdin
backupIsTTY = process.stdin.isTTY;
process.stdin.isTTY = true;
});
afterEach(() => {
if (backupIsTTY) process.stdin.isTTY = backupIsTTY;
delete process.stdin.isTTY;
});
it('it should throw error if function is not provided', () => {