首页 > 解决方案 > R ShinyTest GitHub Actions 在 Windows 上失败,但在 Mac 和 Ubuntu 上通过

问题描述

我的Shinytest测试在 Windows 上失败,但在我的 GitHub Actions CI 上通过了 Mac 和 Ubuntu。它们在我的 Windows 和我的 Mac PC 上都可以在本地通过。

这是我的错误:

-- FAILURE (test-app.R:9:3): all modules work ----------------------------------
Not all shinytest scripts passed for apps/selector_app: selector_test

Diff output:
==== selector_test ====
diff "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\RtmpWYO0Oy/working_dir\\RtmpqmGvu2\\shinytest-diff-690eb816c1/selector_test-expected/001.json" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\RtmpWYO0Oy/working_dir\\RtmpqmGvu2\\shinytest-diff-690eb816c1/selector_test-current/001.json"
1,12c1,12
< {

<   "input": {

<     "selector-procedure": "",

<     "selector-subject: ""

<   },

<   "output": {

<     "text": "You have selected subjectID    and procedure   ."

<   },

<   "export": {

< 

<   }

< }

---
> {
>   "input": {
>     "selector-procedure": "",
>     "selector-subject": ""
>   },
>   "output": {
>     "text": "You have selected subjectID    and procedure   ."
>   },
>   "export": {
> 
>   }
> }

我不知道根据差异有什么不同,或者为什么这会在 Mac 和 Ubuntu 上传递,但在 Windows 上不传递?

标签: rshinygithub-actionstestthat

解决方案


这可能是因为 Windows 如何处理换行符,换行符的编码方式与Linux 和\r\nMacOS\n不同。如果您正在使用 阅读文本输出readBin,请readLines改用。


推荐阅读