From 73ea7fd9e07eb09874c2a2a4ceca22bcc6ddce03 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 14 May 2019 11:45:54 +0200 Subject: [PATCH] Improve setTimeout stub Making it sync breaks bluebird internals (e.g. detection of unhandled rejections). With this patch we make sure it's quick enough but still async --- lib/plugins/aws/provider/awsProvider.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plugins/aws/provider/awsProvider.test.js b/lib/plugins/aws/provider/awsProvider.test.js index 1cf09dbf2..67296ffcc 100644 --- a/lib/plugins/aws/provider/awsProvider.test.js +++ b/lib/plugins/aws/provider/awsProvider.test.js @@ -255,7 +255,10 @@ describe('AwsProvider', () => { describe('#request()', () => { beforeEach(() => { - sinon.stub(global, 'setTimeout', (cb) => { cb(); }); + const originalSetTimeout = setTimeout; + sinon.stub(global, 'setTimeout', (cb, timeout) => { + return originalSetTimeout(cb, Math.min(timeout || 0, 10)); + }); }); afterEach(() => {