0

My Shinytest tests are failing on Windows but passing on Mac and Ubuntu on my GitHub Actions CI. They pass locally just fine on both my Windows and my Mac PC.

This is my error:

-- 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": {
> 
>   }
> }

I can't figure out what is different between according to the diff or why this would pass on Mac and Ubuntu but not on Windows?

Dylan Russell
  • 936
  • 1
  • 10
  • 29
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). What exactly is this test doing? Have you hard coded string values to compare against? Did you develop on a windows machine? It sure does look like an line ending issue but exactly what might cause that is unclear if we can't see any of the code. – MrFlick Nov 16 '20 at 00:04

1 Answers1

0

This is probably because of how Windows handles newlines, which are encoded as \r\n rather than \n as on Linux and MacOS. If you're reading in text output with readBin, use readLines instead.

Hong Ooi
  • 56,353
  • 13
  • 134
  • 187
  • I'm not, I'm simply using the default `shinytest` structure as described at https://rstudio.github.io/shinytest/articles/ci.html. – Dylan Russell Nov 15 '20 at 22:55
  • What may be happening is that shinytest uses `readBin` under the hood. Regardless, you should post the actual code you're using. – Hong Ooi Nov 16 '20 at 02:53