-
Notifications
You must be signed in to change notification settings - Fork 532
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
chore: use @web/test-runner
instead of karma
#1816
Conversation
'http://localhost:9876/context.html' | ||
assert.isOk( | ||
(fetchSpan.attributes['http.url'] as string).startsWith( | ||
'http://localhost:8000/?wtr-session-id=' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL is different, and the session ID unique per run. I think this is fine, but happy to change to whatever you want 🙂
// @ts-expect-error: not an export, but we want the prebundled version | ||
import chai from 'chai/chai.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we'd just get assert
to work in the browser, but for some reason it gives an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used the webpack node polyfills for assert (see
opentelemetry-js-contrib/webpack.node-polyfills.js
Lines 3 to 6 in 434cab2
assert: true, | |
// The assert polyfill from github.com/browserify/commonjs-assert | |
// also requires the `global` polyfill. | |
global: true, |
IMO not using node polyfills for tests that are only intended for the browser is a good idea - I'd be fine for this to switch to chai
, would like to get an opinion on it by @martinkuba or @pkanal first though as they're the subject matter experts 🙂
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1816 +/- ##
==========================================
- Coverage 90.97% 90.85% -0.13%
==========================================
Files 146 143 -3
Lines 7492 7368 -124
Branches 1502 1468 -34
==========================================
- Hits 6816 6694 -122
+ Misses 676 674 -2 |
Hmm, we need to upgrade the node version used to run the browser tests. Not sure how to best do that in a way that still works with the karma ones? or maybe karma works on latest release |
OK, using Node 16 works with both old webpack and the WTR runner 👍 |
Hmm, unsure why code coverage was lost - the output file was located: https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/6928406995/job/18844148357?pr=1816#step:8:79 Pushed an attempt to also produce json output - let's see 😀 |
This reverts commit af20f6c.
This reverts commit 6e3b6fe.
Looks like these are the indirect changes, as far as I understand (codecov is confusing me too 😅) that's changes in coverage to files that have themselves not changed in the PR. This link should be the one to look at (when That being said, the codecov upload in this repo is sometimes flaky (we (the repo maintainers) may have to add a token for it to work properly, though no idea why other runs work fine without it, EDIT: it may be related to this). In the current run it did not upload because of an error, but that error is not related to your PR. The file is actually here, https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/6929736595/job/18848043256?pr=1816#step:8:69 so coverage seems to be working fine 🙂 - it's just codecov that's not uploading it. |
This reverts commit 11100a8.
At least running |
Removing webpack is something we've wanted to do anyway. In the core repo we've been working on updating tooling that was held back by the necessity to support old node versions which are being dropped soon.
Coverage has been in a weird state in this repo for a while. It is likely not your fault. |
Cool! In that case, should I remove karma from the other packages as well so we don't have to run both systems? This PR can also be merged on its own, and then I can follow up for the other packages. Whatever's most convenient to you 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will unblock the browser extension:-) , thank you @SimenB
I think having follow ups to adapt the other instrumentations would be appreciated (once this PR has merged). We'd like to keep tooling in sync as much as possible. 🙂 |
Yeah, happy to do follow-ups - should be quick. I was more asking if you want one big bang in a single PR or split up. |
Amazing, thx! I'd prefer having it split up :) |
Sweet 👍 will do once this is merged |
cc @martinkuba @pkanal (component-owners) - any objections? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brought this up in the SIG Meeting this week and there were no objections to switching. 🙂
@SimenB would you mind giving that PR an update? 🙂 I had been planning to merge it in a while ago but due to conflicts merging was blocked. |
looks like it 👍 |
awesome, thanks 🙂 |
Which problem is this PR solving?
@opentelemetry/instrumentation-document-load
for now - I wanna get some feedback from the team that that this is something you want before spending more time on it 🙂Short description of the changes
karma
is deprecated, and they recommend using Jest or@web/test-runner
as a replacement. Seeing as I guess these theses should run in the browser, I elected to go with@web/test-runner
wtr
already usesmocha
, so that migration is free. However, we also need to replacewebpack
withrollup
/esbuild
- that requires some more changes. I was unable to getassert
to work, so I replaced it withchai
.