cypress-io / cypress-io/code-coverage

No Coverage reported for WebWorkers

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
445
Forks
115
PR merge metrics
No merged PRs in 30d

Description

So I have a bit of a unique set-up in that my library is an integration for both `webpack` and `browserify`. I use `istanbul-instrument-loader` and `babel-plugin-istanbul` to instrument each, respectively. It seems like my worker is being instrumented and my test code instantiates the worker, but I get coverage for everything _except_ the worker. The `webworkify` function I export also has no reported coverage.

You can view the code at [agilgur5/physijs-webpack#cypress-coverage](https://github.com/agilgur5/physijs-webpack/tree/cypress-coverage). It's pretty tiny, basically just `webpack.js`, `browserify.js`, and `browserify-worker-stub.js`, which are all ~5-10 LoC, and their two 5 LoC tests (everything in the `physijs/` directory is for the most part just vendored and can mostly be ignored).
Can install, test, and see coverage with:
```
npm install && npm test && npx nyc report
```
Notably, `physi_worker.js` isn't present in the coverage report, and `browserify-worker-stub.js` shows no coverage for the function it exports (which is called by `webworkify`), despite tests running the worker.
As this is an integration library, it'd be ideal to know that `physijs` (the library it integrates) itself isn't broken due to the integration, so high code coverage of it would give some confidence that nothing has broken.

I'm not totally sure if this is happening because of an `istanbul` issue or a `cypress` issue. When I ran the worker as a fake worker (i.e. on the same thread) in `jsdom` with `jsdom-worker`, I did get coverage for it. So I wonder if the reason it's not showing up in `cypress`'s coverage reports is because it's running in a _real_ worker. (Can read https://github.com/agilgur5/physijs-webpack/issues/6 for more details on how I tried to get coverage to work with all sorts of different toolks, but it shouldn't be necessary to understand this issue)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.