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