Skip to content

Commit 9a062f9

Browse files
Fix assertions
1 parent c4ac733 commit 9a062f9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/unit/bin/helpers/readCypressConfigUtil.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const chai = require("chai"),
33
expect = chai.expect,
44
sinon = require("sinon"),
5+
path = require('path'),
56
EventEmitter = require('events');
67

78
const 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

Comments
 (0)