eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Home Page:https://eggjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

egg-mock 似乎不能检测到 eggjs 项目的 typescript 配置?

Jeff-Tian opened this issue · comments

在此输入你需要反馈的 Bug 具体信息(Bug in Detail):

  1. 我的 eggjs 项目基于 typescript
  2. 项目本身可以正常运行(yarn dev 后可以正常打开 http://localhost:7001)
  3. 确认在配置里正确配置了 config.keys
  4. 但是在使用 egg-mock 跑测试时,报错了。
  5. 报的错误是: Please add config.keys in config/config.default.js
  6. 期待它能够从 config.default.ts 而不是 config.default.js 正确读取 keys

image

可复现问题的仓库地址(Reproduction Repo)

https://github.com/jeff-tian/alpha

Node 版本号:

v15.4.0

Eggjs 版本号:

3.3.0

相关插件名称与版本号(PlugIn and Name):

"egg-mock": "3.16.0",

操作平台与版本号(Platform and Version):

MacBook Pro Apple M1 Pro

原因找到了,这是我在 WebStorm 里使用 mocha 直接跑测试导致的。通过从命令行运行 egg-bin test 不会有这个问题。不过,该怎么在 WebStorm 里运行 typescript eggjs 测试呢?期待分享……

webstorm 终端里面执行 npm run test 就可以了。