Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Top 15 Enterprise Use Cases That Justify Hiring Node.js Developers in 2025

      July 31, 2025

      The Core Model: Start FROM The Answer, Not WITH The Solution

      July 31, 2025

      AI-Generated Code Poses Major Security Risks in Nearly Half of All Development Tasks, Veracode Research Reveals   

      July 31, 2025

      Understanding the code modernization conundrum

      July 31, 2025

      Not just YouTube: Google is using AI to guess your age based on your activity – everywhere

      July 31, 2025

      Malicious extensions can use ChatGPT to steal your personal data – here’s how

      July 31, 2025

      What Zuckerberg’s ‘personal superintelligence’ sales pitch leaves out

      July 31, 2025

      This handy NordVPN tool flags scam calls on Android – even before you answer

      July 31, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Route Optimization through Laravel’s Shallow Resource Architecture

      July 31, 2025
      Recent

      Route Optimization through Laravel’s Shallow Resource Architecture

      July 31, 2025

      This Week in Laravel: Laracon News, Free Laravel Idea, and Claude Code Course

      July 31, 2025

      Everything We Know About Pest 4

      July 31, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      FOSS Weekly #25.31: Kernel 6.16, OpenMandriva Review, Conky Customization, System Monitoring and More

      July 31, 2025
      Recent

      FOSS Weekly #25.31: Kernel 6.16, OpenMandriva Review, Conky Customization, System Monitoring and More

      July 31, 2025

      Windows 11’s MSN Widgets board now opens in default browser, such as Chrome (EU only)

      July 31, 2025

      Microsoft’s new “move to Windows 11” campaign implies buying OneDrive paid plan

      July 31, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Cypress Automation: Tag-Based Parallel Execution with Custom Configuration

    Cypress Automation: Tag-Based Parallel Execution with Custom Configuration

    July 31, 2025

    Custom Parallel Execution Using Tags:

    To enhance the performance of Cypress tests, running them in parallel is a proven approach. While Cypress offers a built-in parallel execution feature, a more flexible and powerful method is tag-based parallel execution using a custom configuration. This method allows to fine-tune which tests are executed concurrently, based on tags in. feature files.

     


    What Is Tag-Based Parallel Execution?

    Tag-based execution filters test scenarios using custom tags (e.g., @login, @checkout) defined in you. feature files. Instead of running all tests or manually selecting files, this method dynamically identifies and runs only the tagged scenarios. It’s particularly useful for CI/CD pipelines and large test suites.

    Key Components:

    This approach uses several cores Node.js modules: 

    • child process – To execute terminal commands. 
    • glob – To search. feature files based on patterns. 
    • fs – To read file content for tag matching. 
    • crypto – To generate unique hashes for port management. 

    Execution Strategy:

    1. Set Tags and Config via Environment Variables:

    You define which tests to run by setting environment variables:

    • TAGS='@db' → runs only tests with @db tag
    • <strong>THREADS=2 → number of parallel threads
    • SPEC='cypress/support/feature/*.feature' → file location pattern
      These variables help dynamically control test selection and concurrency.

    2. Collect All Matching Feature Files:

    Using the glob package, the script searches for all . feature files that match the provided pattern (e.g., *. feature). This gives a complete list of potential test files before filtering by tag.

    3. Filter Feature Files by Tag:

    Each . feature file is opened and scanned using fs.readFileSync(). If it contains the specified tag (like @db or @smoke), it gets added to the list for execution. This ensures only relevant tests run.

    4. Assign Unique Ports for Each File:

    To avoid port conflicts during parallel execution, the script uses crypto.createHash('md5') on the file path + tag combination. A slice of the hash becomes the unique port number. This is crucial when running UI-based tests in parallel.

    5. Run Cypress Tests in Parallel:

    The script spawns multiple Cypress instances using child_process.exec or spawn, one per tagged test file. Each command is built with its own spec file and unique port, and all are run simultaneously using Promises.

    6. Error Handling and Logging:

    If no files match the tag, the script logs a warning and exits cleanly. If any Cypress test fails, the corresponding error is caught, logged, and the overall process exits early to prevent false positives in CI pipelines.

    7. Trigger the Execution from Terminal:

    The full command is triggered from the terminal via a script in package.json:
    "cy:parallel-tag-exec": "cross-env TAGS='@db' THREADS=2 SPEC='cypress/support/feature/*.feature' ts-node parallel-tag-config.ts"

    8. Run the below command:

    npm run cy:parallel-tag-exec

    This executes the full workflow with just one command.


    Complete TypeScript Code

    The code handles the entire logic: matching tags, assigning ports, and running Cypress commands in parallel. Refer to the image below for the full implementation.

    P1

     

    P2

     


    Benefits of This Approach:

    • Greatly reduces overall test runtime.
    • Offers flexibility with test selection using tags.
    • Avoids port conflict issues through dynamic assignment.
    • Works well with CI pipelines and large-scale projects.

     

    Final Thoughts:

    This custom configuration allows you to harness the full power of parallel testing with Cypress in a tag-specific, efficient manner. It’s scalable, highly customizable, and especially suitable for complex projects where targeted test runs are required.

    For more information, you can refer to this website: https://testgrid.io/blog/cypress-parallel-testing/

     

    Similar Approach for Cypress Testing:

    1. Cypress Grep Plugin – https://github.com/cypress-io/cypress-grep
    2. Nx Dev Tools (Monorepo) – https://nx.dev/technologies/test-tools/cypress/api


     

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleWhy Real-Time Voice Translation Is a Game-Changer for Global Contact Centers
    Next Article See Your WordPress Scheduled Tasks (Cron Jobs)

    Related Posts

    Development

    Route Optimization through Laravel’s Shallow Resource Architecture

    July 31, 2025
    Development

    This Week in Laravel: Laracon News, Free Laravel Idea, and Claude Code Course

    July 31, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Xbox layoffs and game cuts wreak havoc on talented developers and the company’s future portfolio — Weekend discussion 💬

    News & Updates

    5 subtle indicators your development environment is under siege

    Tech & Work

    CVE-2025-35939 – Craft CMS Unauthenticated Session File Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Gears of War: Reloaded — Release date, price, and everything you need to know

    News & Updates

    Highlights

    CVE-2025-49837 – GPT-SoVITS-WebUI Deserialization Vulnerability

    July 16, 2025

    CVE ID : CVE-2025-49837

    Published : July 15, 2025, 9:15 p.m. | 5 hours, 38 minutes ago

    Description : GPT-SoVITS-WebUI is a voice conversion and text-to-speech webUI. In versions 20250228v3 and prior, there is an unsafe deserialization vulnerability in vr.py AudioPre. The model_choose variable takes user input (e.g. a path to a model) and passes it to the uvr function. In uvr, a new instance of AudioPre class is created with the model_path attribute containing the aforementioned user input (here called locally model_name). Note that in this step the .pth extension is added to the path. In the AudioPre class, the user input, here called model_path, is used to load the model on that path with torch.load, which can lead to unsafe deserialization. At time of publication, no known patched versions are available.

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    Cosmicding is a client to manage your linkding bookmarks

    May 24, 2025

    Build a Powerful Image Editor with Next.js and glfx.js

    April 1, 2025

    CVE-2025-48056 – Hubble CLI Command Injection Vulnerability

    May 20, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.