Skip to content

Fix: Double Ally testcase save calls #988

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

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open

Conversation

Bhargavi-BS
Copy link
Collaborator

No description provided.

@Bhargavi-BS Bhargavi-BS requested a review from amaanbs August 5, 2025 09:47
amaanbs
amaanbs previously approved these changes Aug 6, 2025
@@ -390,7 +390,7 @@ exports.getSupportFiles = (bsConfig, isA11y) => {
supportFile = userSupportFile[0];
}
} catch (err) {}
if(supportFile && supportFile[0] != '/') supportFile = '/' + supportFile;
if (supportFile && !path.isAbsolute(supportFile)) supportFile = '/' + supportFile;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed? What other places do we use this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karanshah-browserstack this change was done to check if the given path is absolute or not with in-built function in path module

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bhargavi-BS Was this failing in any scenario for you guys?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It had failed once for single path being sent in supportFile - not sure of the reason but then co-pilot had suggested to use this method instead and it passed in the next run

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Windows, ../../karan/project/support.js will return me a absolute path false.
supportFile = /../../karan/project/support.js.
The above condition, is currently handling linux & mac paths imo. Your change will cause issue in Windows. Let's not go ahead with the above change.

glob(process.cwd() + supportFilesData.supportFile, {}, (err, files) => {
if(err) return logger.debug('EXCEPTION IN BUILD START EVENT : Unable to parse cypress support files');

const isPattern = glob.hasMagic(supportFilesData.supportFile);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the changes done as part of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karanshah-browserstack this is to check if the returned supportFile is a single file path or a glob pattern cause if it's a single path then user has explicitly passed in their cypress config and plugins should be added to only that file .If glob pattern is present which we return by default and then that needs to be treated with a loop.

@@ -390,7 +390,7 @@ exports.getSupportFiles = (bsConfig, isA11y) => {
supportFile = userSupportFile[0];
}
} catch (err) {}
if(supportFile && supportFile[0] != '/') supportFile = '/' + supportFile;
if (supportFile && !path.isAbsolute(supportFile)) supportFile = '/' + supportFile;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Windows, ../../karan/project/support.js will return me a absolute path false.
supportFile = /../../karan/project/support.js.
The above condition, is currently handling linux & mac paths imo. Your change will cause issue in Windows. Let's not go ahead with the above change.


const isPattern = glob.hasMagic(supportFilesData.supportFile);
if(!isPattern) {
console.log(`Using user defined support file: ${supportFilesData.supportFile}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to logger.

console.log(`Using user defined support file: ${supportFilesData.supportFile}`);
let file;
try {
file = process.cwd() + supportFilesData.supportFile;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you check whether supportfile is absolute/relative path? If we are always getting an absolute path why do we cwd to be added to it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test it windows + mac, locally.

Copy link
Collaborator

@karanshah-browserstack karanshah-browserstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do a sanity on windows too.

@Bhargavi-BS
Copy link
Collaborator Author

Please do a sanity on windows too.

@karanshah-browserstack - Sanity as in the run cypress tests on both MAC and Windows right ? Can you please clarify here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants