cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Running coverage locally shows empty coverage report

Open sanjeetsuhag opened this issue 2 years ago • 6 comments

As tested on 9b986ab79a00d9a0119985142362f45e4eb8e27c on the main branch, in a clean repository, ran the following commands:

npm install
npm run build
npm run coverage

The terminal log showed that all the tests ran and that that coverage task completed in 2 minutes, however, the report opened up as empty: image

This does not seem to be a problem in CI.

sanjeetsuhag avatar Aug 05 '22 17:08 sanjeetsuhag

@ggetz Are you able to reproduce on macOS? I only tested on Windows.

sanjeetsuhag avatar Aug 05 '22 17:08 sanjeetsuhag

Works fine on Linux (Ubuntu 22.04)

sanjeetsuhag avatar Aug 05 '22 17:08 sanjeetsuhag

No, everything is working for me on Mac. Do you see any errors or warnings in the console? Anything thrown in afterAll maybe?

ggetz avatar Aug 05 '22 18:08 ggetz

I'm running into the same issue on Windows.

j9liu avatar Aug 05 '22 18:08 j9liu

Here's the output:

Chrome 104.0.5112.81 (Windows 10): Executed 13597 of 13707 (5 FAILED) (skipped 110) (2 mins 34.534 secs / 2 mins 27.053 secs)
TOTAL: 5 FAILED, 13592 SUCCESS


1) stops the render loop when render throws
     Widgets/CesiumWidget/CesiumWidget
     Error: Timeout - function did not complete within 5000ms
    at poller (Specs/pollToPromise.js:26:11 <- Build/Specs/SpecList.js:256:11)

2) shows the error panel when render throws
     Widgets/CesiumWidget/CesiumWidget
     Error: Timeout - function did not complete within 5000ms
    at poller (Specs/pollToPromise.js:26:11 <- Build/Specs/SpecList.js:256:11)

3) does not show the error panel if disabled
     Widgets/CesiumWidget/CesiumWidget
     Error: Timeout - function did not complete within 5000ms
    at poller (Specs/pollToPromise.js:26:11 <- Build/Specs/SpecList.js:256:11)

4) stops the render loop when render throws
     Widgets/Viewer/Viewer
     Error: Timeout - function did not complete within 5000ms
    at poller (Specs/pollToPromise.js:26:11 <- Build/Specs/SpecList.js:256:11)

5) shows the error panel when render throws
     Widgets/Viewer/Viewer
     Error: Expected null not to be null.
    at <Jasmine>
    at Specs/Widgets/Viewer/ViewerSpec.js:901:15 <- Build/Specs/SpecList.js:258045:15
     Error: Expected false to be true.
    at <Jasmine>
    at Specs/Widgets/Viewer/ViewerSpec.js:914:23 <- Build/Specs/SpecList.js:258055:23


[10:15:58] Finished 'coverage' after 2.62 min

I added a VSCode task to run the Gulp task and I tried to see if there were any exceptions thrown that would be caught by the debugger, and had no luck there.

sanjeetsuhag avatar Aug 16 '22 14:08 sanjeetsuhag

Interesting, I had this problem too on Linux (Ubuntu 22.04), but then later it worked fine:

Setup that didn't work:

  • I had built cesium implicitly via the Launch Server task in VSCode. The server was still running because I was using it earlier for SpecRunner
  • Then running npm run coverage ran, but encountered errors and the report was empty

Setup that worked:

  • Shut down the server in VSCode
  • run npm run build manually
  • run npm run coverage again, this time it worked

image

This seems similar to another problem I occasionally encountered, after running Launch Server, npm run test sometimes fails to run unless you explicitly run npm run build. Not sure why the build step is different.

ptrgags avatar Aug 29 '22 17:08 ptrgags

The cause of this issue is the regex filter for the instrumented plugin not working for the Windows path separator:

https://github.com/CesiumGS/cesium/blob/0fcd8ca4d0d64f0d9b10c04608f938337f629c2a/gulpfile.js#L1148

I believe all the \\ should be (\\|\/) instead.

sanjeetsuhag avatar Oct 12 '22 09:10 sanjeetsuhag

@sanjeetsuhag I think you mean (\\|\/) instead to escape the forward slash?

ptrgags avatar Oct 12 '22 12:10 ptrgags