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

fix(jest-haste-map): fix missing import statement #8548

Closed
wants to merge 6 commits into from

Conversation

dy93
Copy link

@dy93 dy93 commented Jun 10, 2019

Summary

Fix #8547

Test plan

run yarn test

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.

Thanks @dy93 :)
Are there any new negatives we should test for because of the additional pattern alternative? Regex looks good but maybe something like import + 'inv1' or others you could think of? Just want to be extra safe because this is a critical/low-level piece of code

CHANGELOG.md Outdated Show resolved Hide resolved
@dy93
Copy link
Author

dy93 commented Jun 10, 2019

@jeysal No, I can't come up with any valid js statements that can pass the regular expression but is not mean to import something.
Maybe I can add tests for the additional pattern alternative to the should not extract dependencies inside comments series test cases.

@jeysal
Copy link
Contributor

jeysal commented Jun 10, 2019

Yeah I agree the regex looks good, anyway few negative test cases are good to have to proof it for future changes :)

@codecov-io
Copy link

Codecov Report

Merging #8548 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8548      +/-   ##
==========================================
+ Coverage   60.57%   60.57%   +<.01%     
==========================================
  Files         269      269              
  Lines       11054    11055       +1     
  Branches     2696     2695       -1     
==========================================
+ Hits         6696     6697       +1     
  Misses       3772     3772              
  Partials      586      586
Impacted Files Coverage Δ
...ages/jest-haste-map/src/lib/dependencyExtractor.ts 95.65% <100%> (+0.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ac8ca7...d46edca. Read the comment docs.

@@ -85,7 +90,8 @@ export function extract(code: string): Set<string> {
code
.replace(BLOCK_COMMENT_RE, '')
.replace(LINE_COMMENT_RE, '')
.replace(IMPORT_OR_EXPORT_RE, addDependency)
.replace(IMPORT_OR_EXPORT_FROM_RE, addDependency)
.replace(IMPORT_RE, addDependency)
Copy link
Collaborator

Choose a reason for hiding this comment

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

how does that impact performance? could we squeeze this check into a single regex pass so we don't have to parse the text once more?

@jeysal
Copy link
Contributor

jeysal commented Jul 10, 2019

Hey @dy93, wdyt about @thymikee's idea of merging the regexes?

@dy93
Copy link
Author

dy93 commented Jul 11, 2019

@jeysal LGTM

@jeysal
Copy link
Contributor

jeysal commented Jul 11, 2019

See #8670 (comment), it's implemented there :)

@dy93
Copy link
Author

dy93 commented Jul 11, 2019

It seems to me to close this PR and follow #8670 ?

@dy93 dy93 closed this Jul 12, 2019
@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 11, 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.

dependencyExtractor should consider import 'xxx' statement
6 participants