使用 testcafe v1.17.0。
我有.testcaferc.js新合并的全域鉤子屬性的組態檔。在我的所有裝置中,我都有一個before鉤子,它向 API 發出一定數量的請求,并且通過新的全域鉤子,我想將所有這些 API 呼叫移動到組態檔中。(洗掉重復代碼等原因)
但是,似乎無法將其他檔案或包匯入到組態檔中,因為當我嘗試運行 testcafe 時它會引發以下錯誤:
An error has occurred while reading the "C:\Users\User\Documents\Projects\testcafe\.testcaferc.js" configuration file.
不太確定我需要在這里做什么才能完成這項作業。
我需要匯入組態檔的內容有兩個示例。它們中的任何一個都會引發上述錯誤。
import Shared from "./shared"; // Custom JS file containing functions for the API requests
import clonedeep from 'lodash.clonedeep';
uj5u.com熱心網友回復:
該.testcaferc.js組態檔應在CommonJS的格式,所以你應該使用require來代替import。您匯入的模塊也應該以 cjs 格式撰寫。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/355985.html
標籤:javascript 测试 自动化测试 e2e测试 测试咖啡馆
