Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Git mapping for windows #671

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions bin/testObservability/helper/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,19 @@ exports.getTestEnv = () => {
}

exports.getFileSeparatorData = () => {
const fileSeparatorRegex = /^win/.test(process.platform) ? "\\\\" : "/";
const fileSeparator = /^win/.test(process.platform) ? "\\" : "/";
return {
fileSeparator,
fileSeparatorRegex
};
return /^win/.test(process.platform) ? "\\" : "/";
}

exports.findGitConfig = (filePath) => {
const { fileSeparator, fileSeparatorRegex } = exports.getFileSeparatorData();
const fileSeparator = exports.getFileSeparatorData();
if(filePath == null || filePath == '' || filePath == fileSeparator) {
return null;
}
try {
fs.statSync(filePath + fileSeparator + '.git' + fileSeparator + 'config');
return filePath;
} catch(e) {
let parentFilePath = filePath.split(fileSeparatorRegex);
let parentFilePath = filePath.split(fileSeparator);
parentFilePath.pop();
return exports.findGitConfig(parentFilePath.join(fileSeparator));
}
Expand Down Expand Up @@ -1003,7 +998,7 @@ exports.runCypressTestsLocally = (bsConfig, args, rawArgs) => {
const cypressProcess = spawn(
'npx',
['cypress', 'run', ...getReRunSpecs(rawArgs.slice(1)), ...getLocalSessionReporter()],
{ stdio: 'inherit', cwd: process.cwd(), env: process.env }
{ stdio: 'inherit', cwd: process.cwd(), env: process.env, shell: true }
);
cypressProcess.on('close', async (code) => {
logger.info(`Cypress process exited with code ${code}`);
Expand Down
2 changes: 1 addition & 1 deletion bin/testObservability/reporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class MyReporter {
if(!isBrowserstackInfra()) gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL ? process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL.toString() : null;
const prefixedTestPath = rootParentFile ? this._paths.prefixTestPath(rootParentFile) : 'File path could not be found';

const { fileSeparator, fileSeparatorRegex } = getFileSeparatorData();
const fileSeparator = getFileSeparatorData();

let testData = {
'framework': 'Cypress',
Expand Down
Loading