diff --git a/scripts/cypress-run-with-conditional-record-flag.js b/scripts/cypress-run-with-conditional-record-flag.js index 5688ff704f2ef..559ebd8887ed8 100644 --- a/scripts/cypress-run-with-conditional-record-flag.js +++ b/scripts/cypress-run-with-conditional-record-flag.js @@ -13,18 +13,18 @@ const IS_CI = !!( const shouldRecord = !!process.env.CYPRESS_PROJECT_ID && !!process.env.CYPRESS_RECORD_KEY && IS_CI -const cypressBin = path.join(process.cwd(), `node_modules/cypress/bin/cypress`) +const cypressBin = path.join(process.cwd(), `node_modules/.bin/cypress`) // first arg is node binary itself // second arg is .js file entry point (as in - path to this file) // we only care about extra args -const cypressArgs = [cypressBin, `run`, ...process.argv.slice(2)] +const cypressArgs = [`run`, ...process.argv.slice(2)] if (shouldRecord) { cypressArgs.push(`--record`) } -childProcess.execFileSync(process.execPath, cypressArgs, { +childProcess.execFileSync(cypressBin, cypressArgs, { cwd: process.cwd(), stdio: `inherit`, })