-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Prepare OSS unit tests for jest-circus #82280
Prepare OSS unit tests for jest-circus #82280
Conversation
|
…-modal-full-width # Conflicts: # x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/index.tsx # x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx
@elasticmachine merge upstream |
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.
Straightforward to me for @elastic/kibana-presentation ...!
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 - Thanks Patryk!
Looks like you have conflicts after #83724. Might just want to drop the version bumps as part of this PR since they were updated there. |
…rcus-oss # Conflicts: # packages/kbn-pm/dist/index.js # src/dev/jest/config.js # src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js # yarn.lock
@@ -91,7 +91,6 @@ describe('Integration', () => { | |||
'', | |||
function (err, terms) { | |||
if (testToRun.assertThrows) { | |||
done(); |
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.
Hi @patrykkopycinski ! Thanks for working on this, I did not dig into this too deeply (Console's tests are not in a good state) but I recall needing these done callbacks at one state. I am guessing these were failing before we started remove the "done" callback? Would you mind explaining the problem as you understand it (I see CI is failing on these integration tests)
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.
Hi @jloleysens, so the issue was that with the new runner we cannot use both async
and done
in the same test, so instead of using async/await
I have used .then()
to make sure the assertion is run after the editor is updated and seems that solves the issue
@elasticmachine merge upstream |
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@elasticmachine merge upstream |
src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
Outdated
Show resolved
Hide resolved
const noFind = container.getChild<ContactCardEmbeddable>(embeddable.id); | ||
expect(noFind).toBeUndefined(); | ||
container.removeEmbeddable(embeddable.id); | ||
const promise = container.getOutput$().pipe(first()).toPromise(); |
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.
Can't we simplify these two lines to await container.getOutput$().pipe(first()).toPromise()
?
I don't see anyone reusing the promise const.
(This comment is relevant to multiple places)
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.
@lizozom you were right, Thank you :)
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Distributable file count
History
To update your PR or re-run it, just comment with: |
Summary
Preparation work for:
#77894
This PR enables by default
jest-circus
as the main test runner for our OSS jest tests.Unfortunately
angular-mocks
doesn't support env other thanmocha
orjasmine
(default jest runner), so after discussion with @tylersmalley we have decided to exclude those paths and keep running them usingjasmine2
as there are plans on migrating out ofangular
🎉https://github.com/elastic/kibana/pull/82280/files#diff-486254cfac8fc2554159849cc3bce0640c8ff69e700342b7435acfdff4ac51b7R26
The other case where I wasn't able to migrate successfully to
jest-circus
were integration tests. For some reason tests were not waiting for the test server to start properly, before making an assertion. If someone has an idea please let me know :)https://github.com/elastic/kibana/pull/82671/files#diff-5d852f835ee8a9579c0b9e18fce4991f22dbfab26b2feec1beb94157b77525b8
Checklist