From fd6ca1a33b53df6574241cd8882cafca90cfb9ae Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 4 Jun 2019 13:24:21 +0200 Subject: [PATCH] Do not crash if tmp dir delete fails on win --- tests/mocha-reporter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/mocha-reporter.js b/tests/mocha-reporter.js index 1b8c7854a..a251b9eb4 100644 --- a/tests/mocha-reporter.js +++ b/tests/mocha-reporter.js @@ -75,7 +75,9 @@ module.exports = class ServerlessSpec extends Spec { try { removeSync(tmpDirCommonPath); } catch (error) { - if (error.code !== 'ENOENT') throw error; + if (error.code !== 'ENOENT' || (error.code !== 'EPERM' || process.platform !== 'win32')) { + throw error; + } } if (process.version[1] < 8) return; // Async leaks detector is not reliable in Node.js v6