testthat icon indicating copy to clipboard operation
testthat copied to clipboard

`testthat::test_dir` Error by using `reporter="junit"`

Open elong0527 opened this issue 4 years ago • 1 comments

The code below work properly in our Jenkins CI/CD pipeline until recently we start to get error message while running the code below.

> testthat::test_dir("tests/testthat/", reporter = "junit")
Error in UseMethod("xml_add_child") : 
  no applicable method for 'xml_add_child' applied to an object of class "NULL"

This is probably related to the recent change in this line:

https://github.com/r-lib/testthat/blame/main/R/reporter-junit.R#L130

Here is our Session information

> session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                                      
 version  R version 4.1.1 (2021-08-10)               
 os       Red Hat Enterprise Linux Server 7.9 (Maipo)
 system   x86_64, linux-gnu                          
 ui       RStudio                                    
 language (EN)                                       
 collate  en_US.UTF-8                                
 ctype    en_US.UTF-8                                
 tz       America/New_York                           
 date     2022-01-27                                 

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────
 ! package     * version date       lib source        
   assertthat    0.2.1   2019-03-21 [3] RSPM (R 4.1.1)
   brio          1.1.2   2021-04-23 [3] RSPM (R 4.1.1)
   cachem        1.0.6   2021-08-19 [3] RSPM (R 4.1.1)
   callr         3.7.0   2021-04-20 [3] RSPM (R 4.1.1)
   cli           3.1.0   2021-10-27 [1] RSPM (R 4.1.1)
   colorspace    2.0-2   2021-06-24 [3] RSPM (R 4.1.1)
   crayon        1.4.2   2021-10-29 [1] RSPM (R 4.1.1)
   DBI           1.1.1   2021-01-15 [3] RSPM (R 4.1.1)
   desc          1.4.0   2021-09-28 [3] RSPM (R 4.1.1)
   devtools    * 2.4.2   2021-06-07 [3] RSPM (R 4.1.1)
   dplyr         1.0.7   2021-06-18 [3] RSPM (R 4.1.1)
   ellipsis      0.3.2   2021-04-29 [3] RSPM (R 4.1.1)
   fansi         0.5.0   2021-05-25 [3] RSPM (R 4.1.1)
   fastmap       1.1.0   2021-01-25 [3] RSPM (R 4.1.1)
   fs            1.5.0   2020-07-31 [3] RSPM (R 4.1.1)
   generics      0.1.1   2021-10-25 [1] RSPM (R 4.1.1)
   ggplot2       3.3.5   2021-06-25 [3] RSPM (R 4.1.1)
   glue          1.5.0   2021-11-07 [1] RSPM (R 4.1.1)
   gtable        0.3.0   2019-03-25 [3] RSPM (R 4.1.1)
   lifecycle     1.0.1   2021-09-24 [3] RSPM (R 4.1.1)
   magrittr      2.0.1   2020-11-17 [3] RSPM (R 4.1.1)
   memoise       2.0.0   2021-01-26 [3] RSPM (R 4.1.1)
 P mkthemes    * 0.1.0   2021-12-25 [?] local         
   munsell       0.5.0   2018-06-12 [3] RSPM (R 4.1.1)
   pillar        1.6.4   2021-10-18 [1] RSPM (R 4.1.1)
   pkgbuild      1.2.0   2020-12-15 [3] RSPM (R 4.1.1)
   pkgconfig     2.0.3   2019-09-22 [3] RSPM (R 4.1.1)
   pkgload       1.2.2   2021-09-11 [3] RSPM (R 4.1.1)
   prettyunits   1.1.1   2020-01-24 [3] RSPM (R 4.1.1)
   processx      3.5.2   2021-04-30 [3] RSPM (R 4.1.1)
   ps            1.6.0   2021-02-28 [3] RSPM (R 4.1.1)
   purrr         0.3.4   2020-04-17 [3] RSPM (R 4.1.1)
   R6            2.5.1   2021-08-19 [3] RSPM (R 4.1.1)
   remotes       2.4.1   2021-09-29 [3] RSPM (R 4.1.1)
   rlang         0.4.12  2021-10-18 [1] RSPM (R 4.1.1)
   rprojroot     2.0.2   2020-11-15 [3] RSPM (R 4.1.1)
   rstudioapi    0.13    2020-11-12 [3] RSPM (R 4.1.1)
   scales        1.1.1   2020-05-11 [3] RSPM (R 4.1.1)
   sessioninfo   1.1.1   2018-11-05 [3] RSPM (R 4.1.1)
   testthat    * 3.1.2   2022-01-20 [1] RSPM (R 4.1.1)
   tibble        3.1.6   2021-11-07 [1] RSPM (R 4.1.1)
   tidyselect    1.1.1   2021-04-30 [3] RSPM (R 4.1.1)
   usethis     * 2.0.1   2021-02-10 [3] RSPM (R 4.1.1)
   utf8          1.2.2   2021-07-24 [3] RSPM (R 4.1.1)
   vctrs         0.3.8   2021-04-29 [3] RSPM (R 4.1.1)
   withr         2.4.3   2021-11-30 [1] RSPM (R 4.1.1)
   xml2        * 1.3.2   2020-04-23 [3] RSPM (R 4.1.1)

[1] /home/zhanyilo/R/x86_64-pc-linux-gnu-library/4.1
[2] /data/app/R/Rtoolkit-EIM-1.1.0/4.1.1/lib64/R/library
[3] /baamr/baamrprod_prd/global_r_lib/open_risk/R4.1.1_20211008

 P ── Loaded and on-disk path mismatch.

elong0527 avatar Jan 28 '22 04:01 elong0527

Is there some solution for that? I have exactly the same issue when I'm building my CI/CD jenkins pipeline.

viktorsz18 avatar Feb 14 '22 16:02 viktorsz18

Can either of you provide a reprex?

hadley avatar Sep 19 '22 20:09 hadley

Unfortunately (or luckily), I did not have access to a Jenkins environment anymore.

OK for me to close the issue.

elong0527 avatar Sep 19 '22 22:09 elong0527

I don't have this issue anymore. We upgraded several packages and now pipeline is running. It is ok for me to close this issue as well.

szabadov avatar Sep 21 '22 07:09 szabadov