TestCafe v2.0.0 Released

TestCafe 2.0 is the first stable TestCafe update to include breaking changes. TestCafe now supports TypeScript 4.7 out of the box. The TypeScript 3 compiler is no longer bundled with the framework.

The 2.0 release includes another major new capability. You can now ignore JavaScript errors in specific tests, fixtures, or parts of tests. Additionally, you can ignore JavaScript errors that occur on a specific page, yield a specific error message, or have a particular call stack.

Breaking Change: TypeScript Update

TestCafe introduced TypeScript 3 support in February of 2019. Since then, TypeScript 3 has lost much of its relevance. As the TypeScript 4 user base grew, an increasing number of TestCafe users had to use external TypeScript 4 compilers.

In July of 2022, after careful consideration, the TestCafe team decided to drop TypeScript 3 support. TestCafe v2.0 and up will include an up-to-date version of the TypeScript compiler (v4.7.4).

Users that only run JavaScript tests can upgrade to TestCafe 2.0 directly. If your tests require the TypeScript 3 compiler, you may need to perform additional actions before the upgrade. Follow the migration guide to ensure the compatibility of your test suite with TestCafe 2.0.

Improvement: New ways to ignore JavaScript errors

TestCafe v2.0 introduces new ways to ignore JavaScript errors during test runs.

Just like always, you can use a CLI flag, a configuration file property or the Test Runner API to ignore JavaScript errors throughout your entire test suite.

Two new methods allow you to ignore errors on a per-test or a per-fixture basis.

The t.skipJsErrors action lets you ignore JavaScript errors at specific points in the test.

For each of the methods above, you can define the following options:

  • The pageUrl option filters errors by page URL.
  • The message option filters errors by message.
  • The stack option filters errors by call stack.

Example

The following example ignores all JavaScript errors that meet the following criteria:

  • The error message contains the User ID string.
  • The error call stack contains the jquery string.

This exception applies only during the execution of the Click a button test.

fixture `Authentication tests`
    .page `https://devexpress.github.io/testcafe/`

test('Click a button', async t => {
    await t.click('#button');
}).skipJsErrors({
        message: /.*User ID.*/ig,
        stack: /.*jquery.*/;
    });

Read the Skip JavaScript Errors recipe for a full overview of the new capability.