You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now what I want to do is to have a report that shows the coverage of both the browser and node tests together. From what I've found, c8 doesn't really have an option to merge the results.
The solution I came up with is to use the --coverage option with the "test:browser" script, and by using the following config in my web-test-runner.config.mjs:
That way both testing tools generate their own lcov.info file in their respective folders. Then with the help of the lcov lib I can manage to merge that, but then I'd like to somehow make usage of the c8 report command to output the result on the console.
By manually placing the merged lcov.info file into the coverage/node folder and running the c8 report command, I realized the results didn't change, regardless of the changes in the file, since the report command reads from json files located in the /tmp folder.
So my question is: Is there any way to achieve what I want? To use c8 to report text (on console) a merged result coming from another test runner?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Another point: given the script "test:browser": "npx web-test-runner 'src/spec/browser/**/*.spec.ts' --playwright --browsers chromium firefox". If I just try to run c8 with it as: npx c8 npm run test:browser, I simply get 0% coverage in all aspects, while adding the --coverage flag to the command line generates a correct lcov.info by the web-test-runner.
I'm working on a project where we use two different testing tools - mocha for node tests, and web-test-runner for tests on the browser.
While setting up c8, I could easily set it up to report for the node tests, by simply having a script like:
"test:coverage": "c8 mocha"
Our browser tests script, on the other hand, is called as:
"test:browser": "npx web-test-runner 'src/spec/browser/**/*.spec.ts' --playwright --browsers chromium firefox"
Now what I want to do is to have a report that shows the coverage of both the browser and node tests together. From what I've found, c8 doesn't really have an option to merge the results.
The solution I came up with is to use the
--coverage
option with the"test:browser"
script, and by using the following config in myweb-test-runner.config.mjs
:I then have my
.c8rc
as:That way both testing tools generate their own
lcov.info
file in their respective folders. Then with the help of thelcov
lib I can manage to merge that, but then I'd like to somehow make usage of thec8 report
command to output the result on the console.By manually placing the merged
lcov.info
file into thecoverage/node
folder and running thec8 report
command, I realized the results didn't change, regardless of the changes in the file, since thereport
command reads from json files located in the/tmp
folder.So my question is: Is there any way to achieve what I want? To use
c8
to report text (on console) a merged result coming from another test runner?Thanks in advance.
The text was updated successfully, but these errors were encountered: