TypeError in TestCafe Setup - Cannot Prepare Tests

103 views Asked by At

I am currently facing an issue while attempting to run TestCafe tests, and after various troubleshooting steps, I'm reaching out to the community for assistance.

Error Message:

    C:\Users\HeltPaaFelgen\Documents\TestCafeSystemTest>npx testcafe chrome TestSuites/Login/login.ts --test 'Valid Login'
    ERROR Cannot prepare tests due to the following error:
    

    TypeError: [BABEL] C:\Users\HeltPaaFelgen\Documents\TestCafeSystemTest\node_modules\@babel\plugin-transform-runtime\lib\babel-7\polyfills.cjs:
_index2.createPolyfillPlugins is not a function (While processing: "base$0") (While processing: "base$0")
        at Object.<anonymous> (C:\Users\HeltPaaFelgen\Documents\TestCafeSystemTest\PageModels\MainPage\index.ts:4:1)
        at Object.<anonymous> (C:\Users\HeltPaaFelgen\Documents\TestCafeSystemTest\PageModels\Login\LoginPage.ts:5:1)
        at Object.<anonymous> (C:\Users\HeltPaaFelgen\Documents\TestCafeSystemTest\TestSuites\Login\login.ts:2:1)

Actions Taken:

  • Checked Babel Plugin Versions.
  • Verified Node.js Version.
  • Inspected Babel Configuration (added it to the root folder).
  • Updated Babel Plugins.
  • Cleared Node.js Module Cache.

Versions: TestCafe version: 3.4.0

Babel version: 7.23.6

Despite these efforts, the issue persists. If anyone has encountered a similar problem or has insights into resolving this type of Babel-related TypeError, your guidance would be immensely appreciated.

1

There are 1 answers

1
Pavel Morozov On

This is a bug that occurs with new versions of @babel/plugin-transform-runtime. You can track the progress on it here

While the Testcafe team is investigating the issue, you can override the version of @babel/plugin-transform-runtime through resolutions if you are using Yarn or through the overrides section if you are using npm.