File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -377,19 +377,22 @@ const getCypressCommandEventListener = () => {
377377
378378const setEventListeners = ( ) => {
379379 try {
380+ const cypressCommandEventListener = getCypressCommandEventListener ( ) ;
380381 glob ( process . cwd ( ) + '/cypress/support/*.js' , { } , ( err , files ) => {
381382 if ( err ) return exports . debug ( 'EXCEPTION IN BUILD START EVENT : Unable to parse cypress support files' ) ;
382383 files . forEach ( file => {
383384 try {
384385 if ( ! file . includes ( 'commands.js' ) ) {
385386 const defaultFileContent = fs . readFileSync ( file , { encoding : 'utf-8' } ) ;
386-
387- let newFileContent = defaultFileContent +
387+
388+ if ( ! defaultFileContent . includes ( cypressCommandEventListener ) ) {
389+ let newFileContent = defaultFileContent +
388390 '\n' +
389- getCypressCommandEventListener ( ) +
391+ cypressCommandEventListener +
390392 '\n'
391- fs . writeFileSync ( file , newFileContent , { encoding : 'utf-8' } ) ;
392- supportFileContentMap [ file ] = defaultFileContent ;
393+ fs . writeFileSync ( file , newFileContent , { encoding : 'utf-8' } ) ;
394+ supportFileContentMap [ file ] = defaultFileContent ;
395+ }
393396 }
394397 } catch ( e ) {
395398 exports . debug ( `Unable to modify file contents for ${ file } to set event listeners with error ${ e } ` , true , e ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ const util = require('util');
44const fs = require ( 'fs' ) ;
55const path = require ( 'path' ) ;
66const { requireModule } = require ( '../helper/helper' ) ;
7- const Base = requireModule ( 'mocha/lib/reporters/base.js' , true ) ,
8- utils = requireModule ( 'mocha/lib/utils.js' , true ) ;
7+ const Base = requireModule ( 'mocha/lib/reporters/base.js' ) ,
8+ utils = requireModule ( 'mocha/lib/utils.js' ) ;
99const color = Base . color ;
10- const Mocha = requireModule ( 'mocha' , true ) ;
10+ const Mocha = requireModule ( 'mocha' ) ;
1111// const Runnable = requireModule('mocha/lib/runnable');
12- const Runnable = require ( 'mocha/lib/runnable' , true ) ; // need to handle as this isn't present in older mocha versions
12+ const Runnable = require ( 'mocha/lib/runnable' ) ; // need to handle as this isn't present in older mocha versions
1313const { v4 : uuidv4 } = require ( 'uuid' ) ;
1414
1515const { IPC_EVENTS } = require ( '../helper/constants' ) ;
You can’t perform that action at this time.
0 commit comments