Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Testcafe can't import files in configuration file

Using testcafe v1.17.0.

I have the configuration file .testcaferc.js with the newly merged global hooks property. In all of my fixtures, I have a before hook which does a certain amount of requests to an API, and with the new global hooks I wanted to move all of those API calls to the configuration file. (to remove duplicate code among other reasons)

However, it doesn't seem to be possible to import other files or packages into the configuration file as it throws the following error when I try to run testcafe:

An error has occurred while reading the "C:\Users\User\Documents\Projects\testcafe\.testcaferc.js" configuration file.

Not really sure what I need to do here to make this work.

There are two examples of what I need to import into the config file. Either one of them throws the aforementioned error.

import Shared from "./shared"; // Custom JS file containing functions for the API requests
import clonedeep from 'lodash.clonedeep';
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The .testcaferc.js configuration file should be in the CommonJS format, so you should use require instead of import. Your imported modules should also be written in the cjs format.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!