![](/img/trans.png)
[英]run cypress tests from command line getting => CypressError: Cypress test was stopped while running this command
[英]Getting a "is not a function" error while running a test (javascript, cypress)
下面是我的代碼,當我運行測試時,它出現了幾個月不是 function。 這是一個柏樹測試。 知道我哪里出錯了嗎?
class DateUtils {
getMonthIndexFromName(monthName) {
months = {
January: '1',
Febuary: '2',
March: '3',
April: '4',
May: '5',
June: '6',
July: '7',
August: '8',
September: '9',
October: '10',
Novemebr: '11',
December: '12',
};
return months(monthName);
}
}
export default DateUtils;
months
是 object,而不是 function。 您可能想要的是months[monthName]
動態select months
object中的monthName
屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.