TestCafe v2.3.0 Released
TestCafe v2.3.0 introduces create-testcafe
— an interactive tool that allows you to initialize a new TestCafe project in seconds. The update also includes experimental ECMAScript module support and a number of bug fixes.
Important
TestCafe v2.3.0 ends support for Node.js 14 due to a known vulnerability in the babel-plugin-module-resolver
module.
Install an up-to-date version of the Node.js runtime to use TestCafe v2.3.0 and up.
The official maintenance period for Node.js 14 elapses on April 1st, 2023.
create-testcafe
Use the create-testcafe tool to initialize a new TestCafe project, or add TestCafe to an existing Node.js application.
Execute the following command to launch create-testcafe
:
npx create-testcafe
The create-testcafe
tool allows you to perform the following actions with a single command:
- Create a new folder for the TestCafe project (optional).
- Create a new local installation of TestCafe and its dependencies.
- Create and initialize a TestCafe configuration file.
- Create a separate subfolder for tests.
- Populate the test folder with test examples (optional).
- Create a YAML file with a GitLab Actions workflow that runs TestCafe tests (optional).
Read the TestCafe Setup Wizard guide for more information on the create-testcafe
tool.
Experimental: ECMAScript module support
Important
ESM module suppport works with Node.js 16 and up.
TestCafe has always used CommonJS syntax for module imports:
const { x } = require('y');
An increasing number of Node.JS packages abandon CommonJS in favour of ECMAScript module syntax:
import {x} from 'y'
Enable the --experimental-esm
CLI flag to import modules that do not support CommonJS. Note: tests with ECMASCript module syntax are subject to additional requirements.
testcafe chrome test.js --experimental-esm
Additional Requirements
To run tests with ECMAScript import
statements, make sure that your project meets at least one of the following requirements:
- The value of the
type
key in your project’s package.json file ismodule
. - The test files in your project use the
.mjs
extension.
Bug Fixes
- TestCafe doesn’t delete expired cookies (#7432).
- TestCafe cannot handle windows that appear when the user clicks a link with a
_blank
target (#6926). - TestCafe fails to start because it triggers the
dns.setDefaultResultOrder
method in older Node.js environments (#7447). - TestCafe depends on a vulnerable, outdated version of the
babel-plugin-module-resolver
package (#7456).