romanresh / vscode-testcafe

This extension allows you to run TestCafe tests directly from VS Code
https://marketplace.visualstudio.com/items?itemName=romanresh.testcafe-test-runner
MIT License
47 stars 15 forks source link

Issue/48 - Enable Custom Browser Flags for TestCafe Test Runner Extension #49

Closed Christopher-C-Robinson closed 2 months ago

Christopher-C-Robinson commented 7 months ago

Pull Request: Enable Custom Browser Flags for TestCafe Test Runner Extension

Introduction

This pull request aims to add functionality to the TestCafe Test Runner extension allowing users to include browser-specific flags directly from the Visual Studio Code context menu. Specifically, it enables the --ignore-certificate-errors flag to be appended to the browser argument when running tests.

Changes Made

In the startTestRun function within extension.ts, I've introduced a check within the loop that processes customArguments to detect the --ignore-certificate-errors flag. If found, it appends this flag to the browserArg string. Additionally, to handle cases where browserArg contains spaces due to added flags, I've enclosed browserArg in quotes.

Here's the critical section of the updated code:

// Check for '--ignore-certificate-errors' flag and append to browserArg
if (match !== null) { 
    args.push(match[1] ? match[1] : match[0]); 
    if (match[0] === '--ignore-certificate-errors') {
        browserArg += ' --ignore-certificate-errors';
    }
}

// Enclose browserArg in quotes if it includes flags
if (browserArg.includes(' ')) {
    browserArg = `'${browserArg}'`;
}

args[0] = browserArg; // Update the browser argument with the potentially modified browserArg

Personal Note

As this is only my second time contributing to an open-source project, I'm relatively new to this process. I've done my best to ensure that my changes follow the project's contribution guidelines and provide a meaningful improvement. I hope my contribution is helpful, and I look forward to any feedback that might further refine these changes.

Thank you for considering my pull request.

Best, Christopher-C-Robinson