From 8fcfee6168465405cfddff6895db4356cde97da7 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 16 May 2019 10:07:20 +0200 Subject: [PATCH] Ensure to not wait for stdin when testing --- lib/plugins/aws/invoke/index.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/plugins/aws/invoke/index.test.js b/lib/plugins/aws/invoke/index.test.js index 915911695..1d31aa963 100644 --- a/lib/plugins/aws/invoke/index.test.js +++ b/lib/plugins/aws/invoke/index.test.js @@ -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', () => {