From f9f67c0169cd39b51adecfc2e341d0fd95d95777 Mon Sep 17 00:00:00 2001 From: dead-horse Date: Thu, 23 Jun 2022 19:47:12 +0800 Subject: [PATCH] fix: fix espwoer-typescript inject logic --- 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')); }