由于缺少颜色,github动作中的开玩笑快照测试失败
我在试图设置一个运行Jest Test Suite的GitHub动作时遇到了问题。它 fails>由于使用SnapShots而言。似乎问题可能是由于错误消息上的彩色格式引起的。
提供的屏幕截图是因为我无法使用仅使用Markdown复制到此问题的颜色格式。
测试全部通过本地通过,所以我知道逻辑有效。这是GitHub测试跑步者中的问题,但我不确定如何解决。如果我删除这些特定的测试,它将删除我的代码覆盖范围。如何在这种环境中获得测试?
I am having an issue while trying to set up a Github action that runs my Jest test suite. It fails due to using snapshots. It appears the issue might be caused by the colored formatting on the error messages.
Screenshot provided because I couldn't get the color formatting to copy over to this question using only markdown.
The tests all pass locally, so I know the logic works. It is an issue in the Github test runner, but I'm not sure how to address it. If I remove those particular tests, it will drop my code coverage. How do I get the tests to pass in this environment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您使用
npm test
运行测试,则可以设置环境变量force_color
,从而在github action中发出开玩笑的颜色:Assuming you run your tests with
npm test
, you can set the environment variableFORCE_COLOR
and thereby make jest use color in GitHub Actions as well: