Skip to content

Commit a8b27f3

Browse files
Merge pull request #671 from sauravdas1997/OB-2088-git-linking
fix: Git mapping for windows
2 parents 466d623 + 6ab3a7f commit a8b27f3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

bin/testObservability/helper/helper.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,19 @@ exports.getTestEnv = () => {
163163
}
164164

165165
exports.getFileSeparatorData = () => {
166-
const fileSeparatorRegex = /^win/.test(process.platform) ? "\\\\" : "/";
167-
const fileSeparator = /^win/.test(process.platform) ? "\\" : "/";
168-
return {
169-
fileSeparator,
170-
fileSeparatorRegex
171-
};
166+
return /^win/.test(process.platform) ? "\\" : "/";
172167
}
173168

174169
exports.findGitConfig = (filePath) => {
175-
const { fileSeparator, fileSeparatorRegex } = exports.getFileSeparatorData();
170+
const fileSeparator = exports.getFileSeparatorData();
176171
if(filePath == null || filePath == '' || filePath == fileSeparator) {
177172
return null;
178173
}
179174
try {
180175
fs.statSync(filePath + fileSeparator + '.git' + fileSeparator + 'config');
181176
return filePath;
182177
} catch(e) {
183-
let parentFilePath = filePath.split(fileSeparatorRegex);
178+
let parentFilePath = filePath.split(fileSeparator);
184179
parentFilePath.pop();
185180
return exports.findGitConfig(parentFilePath.join(fileSeparator));
186181
}
@@ -1003,7 +998,7 @@ exports.runCypressTestsLocally = (bsConfig, args, rawArgs) => {
1003998
const cypressProcess = spawn(
1004999
'npx',
10051000
['cypress', 'run', ...getReRunSpecs(rawArgs.slice(1)), ...getLocalSessionReporter()],
1006-
{ stdio: 'inherit', cwd: process.cwd(), env: process.env }
1001+
{ stdio: 'inherit', cwd: process.cwd(), env: process.env, shell: true }
10071002
);
10081003
cypressProcess.on('close', async (code) => {
10091004
logger.info(`Cypress process exited with code ${code}`);

bin/testObservability/reporter/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class MyReporter {
284284
if(!isBrowserstackInfra()) gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL ? process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL.toString() : null;
285285
const prefixedTestPath = rootParentFile ? this._paths.prefixTestPath(rootParentFile) : 'File path could not be found';
286286

287-
const { fileSeparator, fileSeparatorRegex } = getFileSeparatorData();
287+
const fileSeparator = getFileSeparatorData();
288288

289289
let testData = {
290290
'framework': 'Cypress',

0 commit comments

Comments
 (0)