Registry / testing / testcafe-legacy-api

testcafe-legacy-api

JSON →
library5.1.9jsnpmunverified

Provides legacy API support for TestCafe, allowing the use of older TestCafe APIs (e.g., `fixture.page`, `test.page`, `t.setSpeed`, `t.navigateTo`, etc.) in test scripts. Current stable version is 5.1.9. The package is maintained by DevExpress and is required when migrating tests from TestCafe v1.x to v2.x or higher, where the legacy APIs were removed. It acts as a compatibility layer and is only needed if you have existing tests that rely on deprecated TestCafe APIs. Key differentiator: it enables gradual migration without rewriting all tests at once, but is not intended for new projects.

npm install testcafe-legacy-api
INSTALL
IMPORT
SIG · TESTCAFE-LEGACY-AP
T
testcafe-legacy-api
testingjavascriptv5.1.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

legacyApi
import { legacyApi } from 'testcafe-legacy-api'
const legacyApi = require('testcafe-legacy-api')
The package is ESM-only starting from v5. Use ES module import syntax.
default
import testcafeLegacyApi from 'testcafe-legacy-api'
import { default as testcafeLegacyApi } from 'testcafe-legacy-api'
The default export is the main entry point. Do not import as named export with 'default'.
Legacy API types
import type { LegacyApi } from 'testcafe-legacy-api'
import { LegacyApi } from 'testcafe-legacy-api'
Type imports should use `import type` for better tree-shaking and to avoid runtime errors in TypeScript.

Shows how to import legacyApi and use it in a TestCafe fixture to set test speed and skip JS errors, and how to use legacy t.setSpeed in a test.

import { legacyApi } from 'testcafe-legacy-api'; import { Selector } from 'testcafe'; // Use legacy API in a TestCafe fixture export default { [legacyApi]: { speed: 0.5, skipJsErrors: true } }; fixture`Legacy Test`.page`http://example.com`; test('Legacy test with speed', async t => { await t .setSpeed(0.5) // requires legacy-api plugin .click(Selector('button')); });
Debug
Known issues
breakingThis package is intended for TestCafe v2+; it does not work with TestCafe v1.x without the legacy API included.
fix
Ensure you are using TestCafe v2.0.0 or later with this package.
affects: >=5.0.0
deprecatedMany legacy API methods are deprecated in favor of modern TestCafe APIs. Use only if you have existing tests that depend on them.
fix
Migrate tests to use modern TestCafe API (e.g., t.click, t.typeText) instead of legacy methods.
affects: *
gotchaThe package must be imported and registered before any fixtures or tests that use legacy API.
fix
Add `import 'testcafe-legacy-api'` at the top of your test file to ensure the plugin is loaded before fixtures.
affects: *
breakingVersion 5.x dropped CommonJS support; the package is now ESM-only.
fix
Update your project to use ES modules or use dynamic import if necessary.
affects: >=5.0.0
Errors
Common errors & fixes
Error: The legacy API is not available. Ensure that the 'testcafe-legacy-api' plugin is installed.
Missing or incorrect import of the legacy API plugin.
fix
Run `npm install testcafe-legacy-api` and add `import 'testcafe-legacy-api'` at the top of your test file.
TypeError: t.setSpeed is not a function
Using t.setSpeed without the legacy API plugin, or the plugin is not loaded.
fix
Ensure the legacy API plugin is imported and registered before the test runs.
SyntaxError: Cannot use import statement outside a module
The package is ESM-only but your project uses CommonJS.
fix
Add "type": "module" to your package.json or use dynamic import: `import('testcafe-legacy-api')`.
Upgrade
Version history
5.1.9latest on npm
Audit
Dependencies
testcaferequiredRuntime peer dependency; this package provides legacy API integration with TestCafe's test runner.
Agent activity
5 hits · last 30 days
node
4
Resources
testcafe-legacy-api — npm install testcafe-legacy-api · libregistry