升级Jest

时间:2019-03-02 18:21:21

标签: jestjs babel

我将Jest升级到24.1,并通过npx babel-upgrade --write升级了babel。我的使用异步功能的单元测试失败了:

ReferenceError: regeneratorRuntime is not defined。我已经搜寻了这个错误,并且有一些较旧的信息涉及beta 7版本或babel beta 6。如何解决错误?

作为参考,我的package.json和babel.rc文件位于here

1 个答案:

答案 0 :(得分:0)

我最终通过添加到babel.rc文件来解决此问题:

import pandas as pd

df = pd.read_excel('test.xlsx', sheet_name='Essais', skiprows=1)
# Drop the empty row, which is actually the subheader
df.drop(0, axis=0, inplace=True)
# Now we get a count of unique students by group
student_group = df.groupby('GROUPE')[u'ÉTUDIANT'].nunique()

,然后将它们添加为devDependencies:

["@babel/plugin-transform-runtime", { "corejs": 2 }]