Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

386
Views
TestCafe - How to have multiple regex for testGrep in testcaferc file

I'm trying to filter OUT some tests that we have been skipping. "test.skip" is the default way to skip tests, but TestCafe has had issues with runs freezing after skipping a test.

In the mean time, they have a filter option for their testcaferc file that I'd like to use to basically ignore the tests. Since the ignored tests don't show on the report using the filter option, I'm hoping it means that TestCafe won't freeze after ignoring the test.

Their documentation says how to use the filter to only run specified tests, but lacks the negative aspect of this:

https://testcafe.io/documentation/402638/reference/configuration-file#filter

I have been able to filter out a single test just fine, but we have multiple tests we need to ignore for now and when I attempt to add a new regex, the run stops and says "No tests match your filter."

I am looking for a way to have multiple regex so TestCafe knows to ignore multiple tests.

Here's what works:

"filter": {
        "testGrep":
            "^((?!user_is_able_to_add_a_section_column_row_and_element_to_editor).)*$"
}

Here's what doesn't work:

"filter": {
        "testGrep": [
            "^((?!user_is_able_to_add_a_section_column_row_and_element_to_editor).)*$",
            "^((?!pop_up_element_displays_during_page_preview).)*$"
        ]
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The testGrep configuration option only supports a single regex. You can specify a regex with alternation to ignore multiple tests:

"filter": {
    "testGrep": "^(?!.*(Test One|Test Two)).*$"
}

Another way is to use the JS configuration file instead of JSON. It allows you to specify a method in which you can filter tests in any way you want:

module.exports = {
    src: './tests/test.js',
    filter: (testName => !testName.includes('Test One') && !testName.includes('Test Two'))
}

This approach is similar to the Runner.filter method.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!