AVA 测试设置:"Unexpected token export"
AVA test setup: "Unexpected token export"
问题
我正在尝试将 AVA 测试添加到项目中,但我的测试无法使用我的 Babel 设置正确解析 ES2015 模块。对我来说奇怪的是 import
s 工作正常,如果我 运行 我的 npm run build
和 运行 REPL 的输出它工作......所以看起来AVA 没有正确转译 export
语句,或者我的 package.json
中的配置有问题?我尝试通读文档并查看其他示例,但均未成功。
重现步骤
- 克隆https://github.com/trevordmiller/utility-functions
checkout
tests
分支
npm install
npm test
报错(下图)- ES2015 模块 export
错误 getURLSlug
第 7 行:
将 "require": ["babel-register"] 添加到 package.json
中的 AVA 配置
问题
我正在尝试将 AVA 测试添加到项目中,但我的测试无法使用我的 Babel 设置正确解析 ES2015 模块。对我来说奇怪的是 import
s 工作正常,如果我 运行 我的 npm run build
和 运行 REPL 的输出它工作......所以看起来AVA 没有正确转译 export
语句,或者我的 package.json
中的配置有问题?我尝试通读文档并查看其他示例,但均未成功。
重现步骤
- 克隆https://github.com/trevordmiller/utility-functions
checkout
tests
分支npm install
npm test
报错(下图)- ES2015 模块 export
错误 getURLSlug
第 7 行:
将 "require": ["babel-register"] 添加到 package.json
中的 AVA 配置