From 527e3fc801eace07fe8578f94b1a016290aee17b Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Wed, 27 Nov 2024 08:24:00 -0500 Subject: [PATCH] fix: move instrumenter require --- support.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/support.js b/support.js index a1d05b3..110edaf 100644 --- a/support.js +++ b/support.js @@ -9,16 +9,6 @@ const { } = require('./support-utils') const { isPluginDisabled } = require('./common-utils') -// https://github.com/istanbuljs/istanbuljs -// @ts-ignore -const { createInstrumenter } = require('istanbul-lib-instrument') - -const instrumenter = createInstrumenter({ - esModules: true, - compact: false, - preserveComments: true, -}) - dayjs.extend(duration) function getCoverageConfig() { @@ -110,6 +100,17 @@ const registerHooks = () => { if (instrumentScripts) { // the user wants Cypress to instrument the application code // by intercepting the script requests and instrumenting them on the fly + + // https://github.com/istanbuljs/istanbuljs + // @ts-ignore + const { createInstrumenter } = require('istanbul-lib-instrument') + + const instrumenter = createInstrumenter({ + esModules: true, + compact: false, + preserveComments: true, + }) + const baseUrl = Cypress.config('baseUrl') // @ts-ignore const proxyServer = Cypress.config('proxyServer') + '/'