{"id":18855,"library":"testcafe-legacy-api","title":"testcafe-legacy-api","description":"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.","status":"active","version":"5.1.9","language":"javascript","source_language":"en","source_url":"https://github.com/DevExpress/testcafe-legacy-api","tags":["javascript","testcafe","legacy","api"],"install":[{"cmd":"npm install testcafe-legacy-api","lang":"bash","label":"npm"},{"cmd":"yarn add testcafe-legacy-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add testcafe-legacy-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency; this package provides legacy API integration with TestCafe's test runner.","package":"testcafe","optional":false}],"imports":[{"note":"The package is ESM-only starting from v5. Use ES module import syntax.","wrong":"const legacyApi = require('testcafe-legacy-api')","symbol":"legacyApi","correct":"import { legacyApi } from 'testcafe-legacy-api'"},{"note":"The default export is the main entry point. Do not import as named export with 'default'.","wrong":"import { default as testcafeLegacyApi } from 'testcafe-legacy-api'","symbol":"default","correct":"import testcafeLegacyApi from 'testcafe-legacy-api'"},{"note":"Type imports should use `import type` for better tree-shaking and to avoid runtime errors in TypeScript.","wrong":"import { LegacyApi } from 'testcafe-legacy-api'","symbol":"Legacy API types","correct":"import type { LegacyApi } from 'testcafe-legacy-api'"}],"quickstart":{"code":"import { legacyApi } from 'testcafe-legacy-api';\nimport { Selector } from 'testcafe';\n\n// Use legacy API in a TestCafe fixture\nexport default {\n  [legacyApi]: {\n    speed: 0.5,\n    skipJsErrors: true\n  }\n};\n\nfixture`Legacy Test`.page`http://example.com`;\n\ntest('Legacy test with speed', async t => {\n  await t\n    .setSpeed(0.5) // requires legacy-api plugin\n    .click(Selector('button'));\n});","lang":"typescript","description":"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."},"warnings":[{"fix":"Ensure you are using TestCafe v2.0.0 or later with this package.","message":"This package is intended for TestCafe v2+; it does not work with TestCafe v1.x without the legacy API included.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Migrate tests to use modern TestCafe API (e.g., t.click, t.typeText) instead of legacy methods.","message":"Many legacy API methods are deprecated in favor of modern TestCafe APIs. Use only if you have existing tests that depend on them.","severity":"deprecated","affected_versions":"*"},{"fix":"Add `import 'testcafe-legacy-api'` at the top of your test file to ensure the plugin is loaded before fixtures.","message":"The package must be imported and registered before any fixtures or tests that use legacy API.","severity":"gotcha","affected_versions":"*"},{"fix":"Update your project to use ES modules or use dynamic import if necessary.","message":"Version 5.x dropped CommonJS support; the package is now ESM-only.","severity":"breaking","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install testcafe-legacy-api` and add `import 'testcafe-legacy-api'` at the top of your test file.","cause":"Missing or incorrect import of the legacy API plugin.","error":"Error: The legacy API is not available. Ensure that the 'testcafe-legacy-api' plugin is installed."},{"fix":"Ensure the legacy API plugin is imported and registered before the test runs.","cause":"Using t.setSpeed without the legacy API plugin, or the plugin is not loaded.","error":"TypeError: t.setSpeed is not a function"},{"fix":"Add \"type\": \"module\" to your package.json or use dynamic import: `import('testcafe-legacy-api')`.","cause":"The package is ESM-only but your project uses CommonJS.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}