Skip to content

Commit 29ef187

Browse files
committed
refactor: Resolve review comments
1 parent 57ff8d3 commit 29ef187

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

bin/testObservability/helper/helper.js

Lines changed: 3 additions & 8 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
}

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)