22const chai = require ( "chai" ) ,
33 expect = chai . expect ,
44 sinon = require ( "sinon" ) ,
5+ path = require ( 'path' ) ,
56 EventEmitter = require ( 'events' ) ;
67
78const logger = require ( "../../../../bin/helpers/logger" ) . winstonLogger ;
@@ -44,11 +45,12 @@ describe("readCypressConfigUtil", () => {
4445 const readFileSyncStub = sandbox . stub ( fs , 'readFileSync' ) . returns ( '{"e2e": {}}' ) ;
4546 const existsSyncStub = sandbox . stub ( fs , 'existsSync' ) . returns ( true ) ;
4647 const unlinkSyncSyncStub = sandbox . stub ( fs , 'unlinkSync' ) ;
48+ const requireModulePath = path . join ( __dirname , '../../../../' , 'bin' , 'helpers' , 'requireModule.js' ) ;
4749
4850 const result = readCypressConfigUtil . loadJsFile ( 'path/to/cypress.config.ts' , 'path/to/tmpBstackPackages' ) ;
4951
5052 expect ( result ) . to . eql ( { e2e : { } } ) ;
51- sinon . assert . calledOnceWithExactly ( loadCommandStub , `NODE_PATH="path/to/tmpBstackPackages" node "/Users/prajwaldhawarikar/Developer/projects/temp/browserstack-cypress-cli/bin/helpers/requireModule.js " "path/to/cypress.config.ts"` ) ;
53+ sinon . assert . calledOnceWithExactly ( loadCommandStub , `NODE_PATH="path/to/tmpBstackPackages" node "${ requireModulePath } " "path/to/cypress.config.ts"` ) ;
5254 sinon . assert . calledOnce ( readFileSyncStub ) ;
5355 sinon . assert . calledOnce ( unlinkSyncSyncStub ) ;
5456 sinon . assert . calledOnce ( existsSyncStub ) ;
@@ -60,11 +62,12 @@ describe("readCypressConfigUtil", () => {
6062 const readFileSyncStub = sandbox . stub ( fs , 'readFileSync' ) . returns ( '{"e2e": {}}' ) ;
6163 const existsSyncStub = sandbox . stub ( fs , 'existsSync' ) . returns ( true ) ;
6264 const unlinkSyncSyncStub = sandbox . stub ( fs , 'unlinkSync' ) ;
65+ const requireModulePath = path . join ( __dirname , '../../../../' , 'bin' , 'helpers' , 'requireModule.js' ) ;
6366
6467 const result = readCypressConfigUtil . loadJsFile ( 'path/to/cypress.config.ts' , 'path/to/tmpBstackPackages' ) ;
6568
6669 expect ( result ) . to . eql ( { e2e : { } } ) ;
67- sinon . assert . calledOnceWithExactly ( loadCommandStub , `set NODE_PATH=path/to/tmpBstackPackages&& node "/Users/prajwaldhawarikar/Developer/projects/temp/browserstack-cypress-cli/bin/helpers/requireModule.js " "path/to/cypress.config.ts"` ) ;
70+ sinon . assert . calledOnceWithExactly ( loadCommandStub , `set NODE_PATH=path/to/tmpBstackPackages&& node "${ requireModulePath } " "path/to/cypress.config.ts"` ) ;
6871 sinon . assert . calledOnce ( readFileSyncStub ) ;
6972 sinon . assert . calledOnce ( unlinkSyncSyncStub ) ;
7073 sinon . assert . calledOnce ( existsSyncStub ) ;
0 commit comments