Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code coverage with babel istanbul #4649

Merged
merged 9 commits into from
Mar 22, 2022
Merged

code coverage with babel istanbul #4649

merged 9 commits into from
Mar 22, 2022

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Jan 3, 2022

Closes

Describe your changes:

replaces instanbul-intrumenter-loader with babel-plugin-istanbul. Vue <script>s are now covered, but not expressions in <template>

  • remove bad plugin/package and config
  • add new package and config
  • remove legacy-peer-deps option
  • code coverage to be correct
  • code coverage to work codecov.io
  • provide path towards coverage being usable in e2e tests
  • verify internal consumers still build and work fine

The previous instanbul-intrumenter-loader is outdated and abandoned with old Babel dependencies, so as our tooling progresses, it will be incompatible, and it crashes on any new syntax that all modern browsers already support without compiling or poyfilling those features.

This updates to use babel-plugin-istanbul which is maintained, so that it will stay up to date with Babel and latest syntaxes.

This also moves the converage instrumentation webpack config out of karma config into a separate webpack.coverage.js file, which can enable our other test environments besides Karma to also use it (not part of this PR).

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Unit tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue?

To test: run npm run build:coverage and verify that the output in dist has coverage instrumentation (you'll see weird statements injected all over the JS code, but if you see only your plain JS code and nothing strange, then it didn't work).

Reviewer Checklist

  • Changes appear to address issue?
  • Changes appear not to be breaking changes?
  • Appropriate unit tests included?
  • Code style and in-line documentation are appropriate?
  • Commit messages meet standards?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

@trusktr trusktr changed the base branch from master to update-eslint January 3, 2022 19:39
@trusktr trusktr marked this pull request as draft January 3, 2022 19:40
@trusktr trusktr changed the title Add vue code coverage code coverage with babel istanbul Jan 4, 2022
unlikelyzero
unlikelyzero previously approved these changes Jan 4, 2022
@trusktr trusktr force-pushed the update-eslint branch 2 times, most recently from c83c331 to c68223c Compare January 5, 2022 00:33
@trusktr
Copy link
Contributor Author

trusktr commented Jan 5, 2022

hey @unlikelyzero , I see you approved. Are you okay with it not covering Vue code? Also I need to rebase this once both eslint PRs are merged. Then we can see if it'll pass.

@unlikelyzero
Copy link
Collaborator

Yea that's fine for now

@akhenry
Copy link
Contributor

akhenry commented Feb 7, 2022

Still needed in light of using code cov?

@shefalijoshi
Copy link
Contributor

@trusktr Please resolve conflicts. Also, @unlikelyzero , @nikhilmandlik , @trusktr Do we still need this? Discuss and close as needed.

@codecov
Copy link

codecov bot commented Mar 16, 2022

Codecov Report

Merging #4649 (4f5e8ec) into master (b347f35) will increase coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4649      +/-   ##
==========================================
+ Coverage   50.36%   50.44%   +0.08%     
==========================================
  Files         510      511       +1     
  Lines       18657    18665       +8     
  Branches     1657     1644      -13     
==========================================
+ Hits         9396     9415      +19     
+ Misses       8847     8835      -12     
- Partials      414      415       +1     
Impacted Files Coverage Δ
src/plugins/notebook/components/Notebook.vue 22.30% <0.00%> (-1.27%) ⬇️
.../notebook/components/NotebookSnapshotIndicator.vue 70.83% <0.00%> (-1.17%) ⬇️
src/ui/inspector/details/Properties.vue 62.50% <0.00%> (-0.66%) ⬇️
...gins/condition/components/inspector/StylesView.vue 47.66% <0.00%> (-0.30%) ⬇️
src/plugins/notebook/components/NotebookEmbed.vue 0.00% <0.00%> (ø)
src/plugins/plot/lib/eventHelpers.js 86.20% <0.00%> (ø)
...plugins/displayLayout/components/DisplayLayout.vue 2.06% <0.00%> (+<0.01%) ⬆️
src/plugins/displayLayout/components/LineView.vue 1.81% <0.00%> (+0.01%) ⬆️
...pi/forms/components/controls/AutoCompleteField.vue 1.96% <0.00%> (+0.03%) ⬆️
src/plugins/notebook/components/PageCollection.vue 2.85% <0.00%> (+0.07%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b347f35...4f5e8ec. Read the comment docs.

@trusktr trusktr changed the base branch from update-eslint to master March 16, 2022 01:47
@trusktr trusktr dismissed unlikelyzero’s stale review March 16, 2022 01:47

The base branch was changed.

@unlikelyzero unlikelyzero self-requested a review March 16, 2022 15:37
package.json Outdated Show resolved Hide resolved
@trusktr trusktr marked this pull request as ready for review March 16, 2022 20:17
@trusktr
Copy link
Contributor Author

trusktr commented Mar 16, 2022

I was unable to get instrumentation into the JS expressions inside <template>s of Vue components. I asked a couple questions for ideas here:

babel.coverage.js Outdated Show resolved Hide resolved
@jvigliotta
Copy link
Contributor

@trusktr @unlikelyzero can you guys get together on this one?

…k to issue to enable coverage in Vue <template>s
@unlikelyzero unlikelyzero added pr:e2e Automatically triggers e2e tests to run pr:visual labels Mar 22, 2022
@unlikelyzero unlikelyzero self-requested a review March 22, 2022 22:58
@github-actions
Copy link

Started e2e Run. Follow along: https://github.com/nasa/openmct/actions/runs/2025319708

1 similar comment
@github-actions
Copy link

Started e2e Run. Follow along: https://github.com/nasa/openmct/actions/runs/2025319708

Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did a virtual walkthrough of the changes and potential impacts downstream.

@unlikelyzero unlikelyzero added the pr:platform Runs tests against all supported platforms label Mar 22, 2022
@github-actions
Copy link

Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/2025319708

@trusktr trusktr merged commit ca7fbe5 into master Mar 22, 2022
@github-actions
Copy link

Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/2025319708

@trusktr trusktr deleted the add-vue-code-coverage branch March 28, 2022 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:e2e Automatically triggers e2e tests to run pr:platform Runs tests against all supported platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants