From d7e1eff4fdb82805fef4395e124b6cfeb3a48b0a Mon Sep 17 00:00:00 2001 From: Yiyu He Date: Thu, 23 Jun 2022 20:20:02 +0800 Subject: [PATCH] fix: fix espwoer-typescript inject logic (#178) (#179) --- 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 704709c7..889a2970 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')); }