From 5ee0eb70c79e363b73902a91035ce6d8477bf3c0 Mon Sep 17 00:00:00 2001 From: davidholyko Date: Wed, 5 Mar 2025 15:30:34 -0500 Subject: [PATCH] fix: conditionally inject NWTL and simmer.js --- src/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index e9437b7..f384daf 100644 --- a/src/index.js +++ b/src/index.js @@ -15,9 +15,20 @@ const SIMMERJS = fs.readFileSync(require.resolve('simmerjs/dist/simmer.js')).toS let _config = null; function injectNWTL(browser) { - browser.execute(DOM_TESTING_LIBRARY_UMD); + const shouldInject = browser.execute(function () { + return { + domTestingLibrary: !window.TestingLibraryDom, + simmer: !window.Simmer, + } + }); + + if (shouldInject.domTestingLibrary) { + browser.execute(DOM_TESTING_LIBRARY_UMD); + } - browser.execute(SIMMERJS); + if (shouldInject.simmer) { + browser.execute(SIMMERJS); + } if (_config) { // eslint-disable-next-line no-shadow