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

feat: interactive failure runs #10858

Merged
merged 3 commits into from
Feb 18, 2021

Conversation

NullDivision
Copy link
Contributor

@NullDivision NullDivision commented Nov 22, 2020

Closes #7685.

Summary

When running multiple failed tests we may end up with a lot of noise in tests (console logs, deprecation warnings, etc.). Using an interactive mode would allow us to run and fix each test in isolation without having to manually run and re-run tests.

Test plan

demo-7685

@facebook-github-bot
Copy link
Contributor

Hi @NullDivision!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@jeysal jeysal requested a review from SimenB November 22, 2020 21:13
@NullDivision NullDivision force-pushed the feat/7685-InterractiveFailureRuns branch from 4c970a9 to 4ae9184 Compare November 22, 2020 21:18
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

4 similar comments
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

This looks pretty good! Could you add a gif to the OP that shows how it looks in use?

packages/jest-core/src/plugins/FailedTestsInteractive.ts Outdated Show resolved Hide resolved
packages/jest-core/src/plugins/FailedTestsInteractive.ts Outdated Show resolved Hide resolved
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks! left some nits, code lgtm 👍

packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
packages/jest-core/src/FailedTestsInteractiveMode.ts Outdated Show resolved Hide resolved
@NullDivision NullDivision force-pushed the feat/7685-InterractiveFailureRuns branch 2 times, most recently from 4a22ccf to d6aad96 Compare November 25, 2020 12:07
@SimenB
Copy link
Member

SimenB commented Nov 25, 2020

Question: why is this a separate plugin from the interactive snapshot one? Wouldn't it make sense for this to be 1 plugin? Possibly with some "sub-mode" for "just tests" or "just snapshots"

@NullDivision
Copy link
Contributor Author

Question: why is this a separate plugin from the interactive snapshot one? Wouldn't it make sense for this to be 1 plugin? Possibly with some "sub-mode" for "just tests" or "just snapshots"

I've actually thought about that myself and for the most part it would be a fairly straightforward solution but would also mean refactoring some stuff:

  • renaming all the snapshot plugin components
  • refactoring usage information (mostly labeling and conditional options)
  • keeping track of what "mode" we're running in (snapshot/non-snapshot)
  • refactoring onKey to exclude options on non-snapshot tests

The choice was either to copy the logic as is and refactor at a later date or risk breaking something in the existing plugin. For an initial implementation I thought it might make more sense to do the former. But I'm open (albeit somewhat reluctant) to doing the refactor in this PR)

@SimenB
Copy link
Member

SimenB commented Nov 26, 2020

@thymikee @jeysal @rickhanlonii thoughts?

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

I'm good with this being a separate plugin, but if we want to refactor, make it in a separate PR. Also, how about combining 2 tests into one for FailedTestInteractive, is it feasible?

@NullDivision
Copy link
Contributor Author

Also, how about combining 2 tests into one for FailedTestInteractive, is it feasible?

I'm not sure I follow. Are you talking about combining the test instrumentation and usage info tests? Can do.

@thymikee
Copy link
Collaborator

@NullDivision yes, thanks!

@NullDivision NullDivision force-pushed the feat/7685-InterractiveFailureRuns branch from d6aad96 to 486efd7 Compare November 28, 2020 15:23
@NullDivision NullDivision force-pushed the feat/7685-InterractiveFailureRuns branch from 486efd7 to 816d298 Compare December 8, 2020 22:40
feat: add plugin logic
Apply suggestions from code review

Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>

style: update usage info labels

test: merge tests with similar conditions
@NullDivision NullDivision force-pushed the feat/7685-InterractiveFailureRuns branch from 816d298 to d853b70 Compare January 18, 2021 07:24
@SimenB SimenB changed the title Feat/7685 interractive failure runs feat: interactive failure runs Feb 18, 2021
@SimenB SimenB merged commit 15010f1 into jestjs:master Feb 18, 2021
@SimenB
Copy link
Member

SimenB commented Feb 18, 2021

Thanks @NullDivision!

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interactive mode for all failing tests
4 participants