From 2e0fecd06e9c901d370d54542e1aa6dc7b183403 Mon Sep 17 00:00:00 2001 From: Yiyu He Date: Thu, 23 Jun 2022 20:12:18 +0800 Subject: [PATCH] fix: fix espwoer-typescript inject logic (#178) --- lib/cmd/test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cmd/test.js b/lib/cmd/test.js index 3c3a0af6..4e479015 100644 --- a/lib/cmd/test.js +++ b/lib/cmd/test.js @@ -116,7 +116,9 @@ class TestCommand extends Command { // for power-assert if (testArgv.typescript && testArgv.espower) { - requireArr.splice(requireArr.indexOf(testArgv.tscompiler), 1); + if (requireArr.includes(testArgv.tscompiler)) { + requireArr.splice(requireArr.indexOf(testArgv.tscompiler), 1); + } requireArr.push(testArgv.tscompiler, require.resolve('../espower-typescript')); }