【发布时间】:2021-04-26 12:08:06
【问题描述】:
赛普拉斯似乎无法正确识别默认导出的函数。示例:
export default function (array) {
const randomValue = array[Math.floor(Math.random() * array.length)];
return randomValue;
}
import randomValueFromArray from '../../../../../support/index';
randomValueFromArray([1, 2]).then((value) => {
cy.log('VALUE', value);
});
赛普拉斯跑步者错误:
(0 , _index.default) is not a function
【问题讨论】:
-
无法复制,对我来说可以正常工作。但是
randomValueFromArray([1, 2]).then()无效,因为您的函数没有返回承诺。
标签: javascript ecmascript-6 cypress es6-modules