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

Add validation wrapper for PatternPrompt class #7447

Closed
wants to merge 225 commits into from

Conversation

captain-yossarian
Copy link

@captain-yossarian captain-yossarian commented Dec 2, 2018

Summary

Due to #7382

Test plan

@facebook-github-bot
Copy link
Contributor

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 up 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 the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@captain-yossarian
Copy link
Author

captain-yossarian commented Dec 2, 2018

@SimenB Can you please check the algorithm of my fix?
I had not add tests because I'm not sure if my code fit the jest code styleguide.

@natealcedo
Copy link

@SerhiiBilyk Are you still working on this? I'd still love this feature to be included. I keep fat fingering things in watch mode.

@captain-yossarian
Copy link
Author

@natealcedo, I am waiting for review now

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.

Code LGTM, thanks! This is however missing tests and a changelog entry before we can merge 🙂

Also, could you post some screenshots for how this looks?

@captain-yossarian
Copy link
Author

@SimenB @rickhanlonii @rogeliog screenshots:
jest_regexp_issue
jest_regexp_issue2

@captain-yossarian
Copy link
Author

@rickhanlonii @SimenB Can you please help me with testing?

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.

Please update the changelog.

When it comes to a test, you can add an integration test in https://github.com/facebook/jest/blob/64b3a9b72b8cba4bd303cc0c9f87d23645635936/e2e/__tests__/watchModePatterns.test.js

There you can see how patterns are provided 🙂 If you're willing, some unit tests would be great as well!

@natealcedo
Copy link

@SerhiiBilyk I would suggest just writing all the tests first and then asking for a review. If you are unsure on how to write tests you should take a look at the CONTRIBUTING.md. That way, reviewers can give feedback on all of your code at one go rather than waiting for a review before writing tests.

@captain-yossarian
Copy link
Author

@natealcedo ok.

@captain-yossarian
Copy link
Author

@SimenB @rickhanlonii
I've add e2e tests.
Like I understand , unit tests of PatternPrompt are in jest-cli/src/tests/watch_filename_pattern_mode.test.
But I don't know how to configure them.
I will appreciate for any help. Thank you

@jeysal
Copy link
Contributor

jeysal commented Feb 2, 2019

Like I understand , unit tests of PatternPrompt are in jest-cli/src/tests/watch_filename_pattern_mode.test

Yes, and in watch_test_name_pattern_mode.test. You could for example copy the test case "Pressing P enters pattern mode" and modify it so that it types an invalid pattern and tries to press enter, and then assert that Jest does not try to rerun with the invalid pattern.

@captain-yossarian
Copy link
Author

@jeysal thank you for your tip. Can you check please my unit test?

@thymikee
Copy link
Collaborator

btw, @SerhiiBilyk can you rebase your work to master? jest-watcher was recently converted to TypeScript

@jeysal
Copy link
Contributor

jeysal commented Feb 10, 2019

@jeysal thank you for your tip. Can you check please my unit test?

Looking good, that's what I thought of 👍
As @thymikee said, the TypeScript migration unfortunately causes a few conflicts for existing PRs so you'll have to rebase, then we can give it a final review :)

@SimenB
Copy link
Member

SimenB commented Feb 10, 2019

Don't worry too much about the conflict, we can resolve that ourselves before merging 🙂

@captain-yossarian
Copy link
Author

@thymikee @jeysal @SimenB branch is rebased

Copy link
Contributor

@jeysal jeysal left a comment

Choose a reason for hiding this comment

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

LGTM if CI passes
Edit: and if you add a changelog entry as mentioned in @SimenB's review :)

@@ -90,6 +100,16 @@ Object {
}
`;

exports[`Watch mode flows Pressing "P" enters pattern mode and invalid regexp 1`] = `
Copy link
Contributor

Choose a reason for hiding this comment

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

This snapshot seems obsolete?

Copy link
Author

Choose a reason for hiding this comment

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

Yes

@@ -39,7 +39,7 @@ export default class Prompt {

enter(
onChange: (pattern: string, options: ScrollOptions) => void,
onSuccess: () => void,
onSuccess: (pattern: string) => void,
onCancel: () => void,
Copy link
Collaborator

@thymikee thymikee Feb 10, 2019

Choose a reason for hiding this comment

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

onCancel has different fn signature than https://github.com/facebook/jest/pull/7447/files?w=1#diff-048f6a2e1f2d542739b5b37c81a7e9c3R16, I think it's still should be _onCancel: (value?: string) => void

Copy link
Member

Choose a reason for hiding this comment

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

We initialize to empty string, so the correct type is that it's passed. right?

@captain-yossarian
Copy link
Author

Is it still relevant ?

@SimenB
Copy link
Member

SimenB commented Jul 15, 2019

Yeah, I'd say so! Would you mind rebasing?

@rogeliog
Copy link
Contributor

I agree, this is still relevant

H1Gdev and others added 4 commits July 18, 2019 18:48
* removed default value of prettierPath from argv

* updated snapshot for show_config

* updated changelog

* fixed wrong package name in changelog
* (fix) message should return a function

message should return a function and not a constant

* Update CHANGELOG.md
* Update CHANGELOG formatting

* Dedupe
SimenB and others added 22 commits July 18, 2019 18:48
* Migrate jest-changed-files to Typescript

* Add changelog entry

* Update e2e/__tests__/jestChangedFiles.test.js

Co-Authored-By: loryman <[email protected]>

* Stricter typings


Merge remote-tracking branch 'origin/jest-changed-files-typescript' into jest-changed-files-typescript

* Make prettier happy
## Summary

It doesn't make sense to wrap a `runJust` call into `stripAnsi` since the latter works only with strings.
`runJest` returns an object so stripAnsi just passes it along.

Materials:

- Commit where the code was added in the first place: jestjs@e12cab6#diff-4cf7d6c79ff377b63522b3af20e34e8eR307
- stripAnsi source code: https://github.com/chalk/strip-ansi/blob/097894423fedb6b4dca3005ad45608b893fcdcf8/index.js
* chore: migrate jest-matcher-util to TypeScript

* link to PR

* unknown and fix flow
@captain-yossarian
Copy link
Author

@SimenB @thymikee Sorry, but I will have no time to do thi PR until September. So, feel free to reassign this PR to other people

@github-actions
Copy link

github-actions bot commented Sep 8, 2022

This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Sep 8, 2022
@github-actions
Copy link

github-actions bot commented Oct 8, 2022

This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this Oct 8, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

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 Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.