From b45bd818342acdcda3f9bdbbc496195e9883cca8 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 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')); }