【发布时间】:2020-01-19 06:53:45
【问题描述】:
我正在尝试将 ci/cd 工作流与 github Actions 一起使用,
我使用 jest 进行单元测试并设置 moduleNameMapper 如下:
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/src/$1",
"^components/(.*)$": "<rootDir>/src/components/$1"
}
我可以在本地成功运行npm test,但是github操作总是出错:
Could not locate module src/components/tool-panel/Container.vue (mapped as /home/runner/work/its-me/its-me/src/components/tool-panel/Container.vue)
Please check:
"moduleNameMapper": {
"/^src\/(.*)$/": "/home/runner/work/its-me/its-me/src/$1"
},
"resolver": undefined
似乎<rootDir> 被替换为/home/runner/work/its-me/its-me,并且此路径中没有文件夹src:/home/runner/work/its-me/its-me。
那么如何设置正确的根路径?
我不确定我是否可以 ssh 到 github 操作服务器。
这是我的 github 仓库:It's me
任何帮助将不胜感激!
【问题讨论】:
标签: jestjs github-actions