quasarframework / quasar-testing

Testing Harness App Extensions for the Quasar Framework 2.0+
https://testing.quasar.dev
MIT License
180 stars 65 forks source link

#227: Webpack code coverage support #266

Open gtrombitas opened 2 years ago

gtrombitas commented 2 years ago

What kind of change does this PR introduce? (check at least one)

If you are adding a new test runner, have you...? (check all)

Does this PR introduce a breaking change? (check one)

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

Other information:

add @cypress/code-coverage according to this link (babel-plugin-istanbul isn't needed here because it's bundled with coverage-istanbul-loader.

add "code-coverage" option to quasar.extensions.json

"@quasar/testing-e2e-cypress": {
    "options": [
      "scripts",
      "typescript",
      "code-coverage"
    ]
  }

add nyc settings in the end of package.json

"nyc": {
"temp-dir": "temp/.nyc_output",
"include": [
"src/**"
],
"extension": [
".js",
".ts",
".vue"
],
"report-dir": "test/cypress/coverage"
}

execute sync:cypress npm script in test-project-webpack project

IlCallo commented 2 years ago

Thanks for the contribution :) I don't have time to test it right now, but I left some comments on what seems to be off at a first glance

gtrombitas commented 2 years ago

@IlCallo I fixed the requested changes please check them.

maiolica commented 2 years ago

hi @gtrombitas, and thanks for the PR, I have run some tests on it. Coverage of .ts files is perfect, but .vue files seem to have some issues, it seems all files are getting the exact same coverage, with the same uncovered block position (see screens).

image image

gtrombitas commented 2 years ago

@maiolica Thank you for the review and testing effort. Unfortunately I couldn't find any other solutions to handle .vue file instrumentation better. I opened an issue to coverage-istanbul-loader library: link Hopefully they can advise a concrete solution or a workaround for this problem.

IlCallo commented 1 year ago

I'm regularly checking that issue, but the project seems abandoned since 2020 The whole Instanbul ecosystem seems freezed in time right now

Is there any reliable alternative into JS ecosystem?

gtrombitas commented 1 year ago

Thanks for the sync-up. Yes, I have seen the same thing at Istanbul repo. Unfortunately I'm not familiar with any other alternatives to this library. When I have a little time for it then I'll try to look into some other libs. If something already exists at all...