2
2
const chai = require ( "chai" ) ,
3
3
expect = chai . expect ,
4
4
sinon = require ( "sinon" ) ,
5
+ path = require ( 'path' ) ,
5
6
EventEmitter = require ( 'events' ) ;
6
7
7
8
const logger = require ( "../../../../bin/helpers/logger" ) . winstonLogger ;
@@ -44,11 +45,12 @@ describe("readCypressConfigUtil", () => {
44
45
const readFileSyncStub = sandbox . stub ( fs , 'readFileSync' ) . returns ( '{"e2e": {}}' ) ;
45
46
const existsSyncStub = sandbox . stub ( fs , 'existsSync' ) . returns ( true ) ;
46
47
const unlinkSyncSyncStub = sandbox . stub ( fs , 'unlinkSync' ) ;
48
+ const requireModulePath = path . join ( __dirname , '../../../../' , 'bin' , 'helpers' , 'requireModule.js' ) ;
47
49
48
50
const result = readCypressConfigUtil . loadJsFile ( 'path/to/cypress.config.ts' , 'path/to/tmpBstackPackages' ) ;
49
51
50
52
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"` ) ;
52
54
sinon . assert . calledOnce ( readFileSyncStub ) ;
53
55
sinon . assert . calledOnce ( unlinkSyncSyncStub ) ;
54
56
sinon . assert . calledOnce ( existsSyncStub ) ;
@@ -60,11 +62,12 @@ describe("readCypressConfigUtil", () => {
60
62
const readFileSyncStub = sandbox . stub ( fs , 'readFileSync' ) . returns ( '{"e2e": {}}' ) ;
61
63
const existsSyncStub = sandbox . stub ( fs , 'existsSync' ) . returns ( true ) ;
62
64
const unlinkSyncSyncStub = sandbox . stub ( fs , 'unlinkSync' ) ;
65
+ const requireModulePath = path . join ( __dirname , '../../../../' , 'bin' , 'helpers' , 'requireModule.js' ) ;
63
66
64
67
const result = readCypressConfigUtil . loadJsFile ( 'path/to/cypress.config.ts' , 'path/to/tmpBstackPackages' ) ;
65
68
66
69
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"` ) ;
68
71
sinon . assert . calledOnce ( readFileSyncStub ) ;
69
72
sinon . assert . calledOnce ( unlinkSyncSyncStub ) ;
70
73
sinon . assert . calledOnce ( existsSyncStub ) ;
0 commit comments