lukejpreston / xunit-viewer

View your xunit results using JavaScript
MIT License
188 stars 43 forks source link

`xunit-viewer` fails to run in server mode #145

Closed radeusgd closed 4 months ago

radeusgd commented 10 months ago

I try to run the following command:

xunit-viewer -r .\target\Table_Tests\JUnit.xml -s -p 5050

first I get

Written to: C:\NBO\enso\index.html
Listening at http://192.168.100.36:5050

fine, but as soon as I visit the website, I get:

file:///C:/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/src/cli/get-suites.js:9
  for (const { file, contents } of files) {
                                   ^

TypeError: files is not iterable
    at default (file:///C:/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/src/cli/get-suites.js:9:36)
    at file:///C:/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/src/cli/server.js:19:26
    at Layer.handle [as handle_request] (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\route.js:144:13)
    at Route.dispatch (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\route.js:114:3)
    at Layer.handle [as handle_request] (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\index.js:284:15
    at Function.process_params (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\router\index.js:280:10)
    at expressInit (C:\Users\progr\AppData\Roaming\nvm\v18.14.1\node_modules\xunit-viewer\node_modules\express\lib\middleware\init.js:40:5)

Node.js v18.14.1

The file that I'm referencing, if it is ever needed: Table_Tests.zip

radeusgd commented 10 months ago

Hmm, I've tried on WSL and the failure persists, so I'm not sure it's strictly a Windows issue:

WSL> xunit-viewer -r enso/target/Table_Tests -s -w
IGNORING: /mnt/c/NBO/enso/target/Table_Tests/JUnit.xml.bak
IGNORING: /mnt/c/NBO/enso/target/Table_Tests/Table_Tests.zip
Written to: /mnt/c/NBO/index.html
Listening at http://172.28.138.202:3000
IGNORING: /mnt/c/NBO/enso/target/Table_Tests/JUnit.xml.bak
IGNORING: /mnt/c/NBO/enso/target/Table_Tests/Table_Tests.zip
(node:21433) UnhandledPromiseRejectionWarning: TypeError: files is not iterable
    at default (file:///mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/src/cli/get-suites.js:9:36)
    at file:///mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/src/cli/server.js:19:26
    at Layer.handle [as handle_request] (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/layer.js:95:5)
    at next (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/layer.js:95:5)
    at /mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/index.js:346:12)
    at next (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/router/index.js:280:10)
    at expressInit (/mnt/c/Users/progr/AppData/Roaming/nvm/v18.14.1/node_modules/xunit-viewer/node_modules/express/lib/middleware/init.js:40:5)
(node:21433) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:21433) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
manjumaikan commented 9 months ago

https://github.com/lukejpreston/xunit-viewer/pull/147 should fix the issue

lukejpreston commented 9 months ago

I have merged this into 10.5 Could you try again, please? I don't have access to Windows but for whatever reason this works on Max and Linux when it probably shouldn't 😄

manjumaikan commented 9 months ago

Thanks @lukejpreston . I'll test one some time soon . However I would like to let you know that my tests were run on RHEL 7 machine. I guess this might solve the issue for most cases 😄

manjumaikan commented 9 months ago

Managed to text it on RHEL. Looks good now.