-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] adding plugin to flush coverage data #83447
Conversation
public start() {} | ||
|
||
public setup() { | ||
(window as WindowWithCoverage & typeof globalThis).flushCoverageToLog = function () { |
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.
is that not supposed to be double-and &&
?
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.
Single-and is a bitwise op.
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.
I don't think it is needed here, since I'm not doing logical operation like window && typeof window === "object"
I just searched a bit and found it here
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.
Yeah, in type signatures a single &
between two types creates a union type of the two.
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.
Just concerned about the bitwise ops.
public start() {} | ||
|
||
public setup() { | ||
(window as WindowWithCoverage & typeof globalThis).flushCoverageToLog = function () { |
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.
I think we can clean this up by creating a local variable with the types assigned once and use that local variable rather than re-casting window over and over.
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.
@spalger @wayneseymour what do you think about 38163d2
declare global {
interface Window {
__coverage__: any;
flushCoverageToLog: any;
}
}
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.
LGTM
Many tests failed with the same error:
That was not a case when I updated bootstrap.js template directly. @restrry did I miss something important? |
@dmlemeshko
@elastic/kibana-operations is that correct? |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
All good now, coverage is fixed |
…o-node-details * 'master' of github.com:elastic/kibana: (65 commits) update chromedriver dependency to 87 (elastic#83624) [TSVB] use new Search API for rollup search (elastic#83275) [TSVB] Y-axis has number formatting not considering all series formatters in the group (elastic#83438) [Logs UI] Update <LogStream /> internal state when its props change (elastic#83302) Add tag bulk action context menu (elastic#82816) [code coverage] adding plugin to flush coverage data (elastic#83447) [UsageCollection] Expose `KibanaRequest` to explicitly opted-in collectors (elastic#83413) Added eventBus to trigger and listen plotHandler event (elastic#83435) [Runtime fields] Editor phase 1 (elastic#81472) [Maps] Fix threshold alert issue resolving nested fields (elastic#83577) chore(NA): remove usage of unverified es snapshots (elastic#83589) [DOCS] Adds Elastic Contributor Program link (elastic#83561) Upgrade EUI to v30.2.0 (elastic#82730) Don't show loading screen during auto-reload (elastic#83376) Functional tests - fix esArchive mappings with runtime fields (elastic#83530) [deb/rpm] Create keystore after installation (elastic#76465) [rpm] Create default environment file at "/etc/sysconfig/kibana" (elastic#82144) [docker] removes workaround for missing crypto-policies-scripts subpackage (elastic#83455) [ML] Persisted URL state for the Data frame analytics jobs and models pages (elastic#83439) adds xpack.security.authc.selector.enabled setting (elastic#83551) ...
Summary
In order to bring back code coverage collection for functional tests this PR adds new plugin that simply adds
flushCoverageToLog
that we use to check for coverage before unload event and put it into console, in case__coverage__
property has data.Shout-out to @restrry for plugin idea!
Related code coverage job to test PR: https://kibana-ci.elastic.co/job/elastic+kibana+qa-research/131/