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

tests: add tests for project root finder util #1483

Merged
merged 4 commits into from
Apr 28, 2020

Conversation

anshumanv
Copy link
Member

What kind of change does this PR introduce?
Test

Did you add tests for your changes?
Yes

If relevant, did you update the documentation?
NA

Summary

Does this PR introduce a breaking change?
No

Other information
Any suggestions are appreciated.

@anshumanv anshumanv requested a review from a team as a code owner April 19, 2020 07:12
@anshumanv
Copy link
Member Author

@rishabh3112 init tests seem to fail for some reason, when I was debugging it yesterday it seems that we're checking yarn.lock file too soon before it's created. You can follow - #1478

@rishabh3112
Copy link
Member

@anshumanv the reason you specified isn't possible as currently runPromptWithAnswers didn't exit the process until it exit on it's own. So, it should be there if this has to be there after it exits.

You may add debug logs to check which files are created while we are testing the existance of yarn.lock ( may be npm is being used during installation and package-lock.json created instead ).

@anshumanv
Copy link
Member Author

You may add debug logs to check which files are created while we are testing the existance of yarn.lock ( may be npm is being used during installation and package-lock.json created instead ).

Already did in plugin PR, yarn.lock wasn't found and no package-lock wasn't created either, I think there's some IO gap in the time it takes to write the file on disk and we may be checking before that.

@anshumanv
Copy link
Member Author

This is happening in several PRs, you can check those too

@anshumanv
Copy link
Member Author

For example check here - #1480 @rishabh3112

@rishabh3112
Copy link
Member

Already did in plugin PR, yarn.lock wasn't found and no package-lock wasn't created either, I think there's some IO gap in the time it takes to write the file on disk and we may be checking before that.

That is only possible if yarn exits its install process without waiting for yarn.lock file to be created. Is that the case?

Anyway, to find actual reason,
Try debug logging before tests to find the exact reason.

  • Use fs.readdir for looking at files being created in macos container. (As test fail at macos only).
  • This could also be possible that some error was encountered and process ended in between, so try logging stdout too to check if thats the case.
  • Look at the commits being added to next branch that change the behavior of runInitWithAnswers after I added these tests. As init tests were passing in CI at that point of time.

Hope this helps :)

@anshumanv
Copy link
Member Author

anshumanv commented Apr 20, 2020

That is only possible if yarn exits its install process without waiting for yarn.lock file to be created. Is that the case?

Anyway, to find actual reason, Try debug logging before tests to find the exact reason.

Did all of that already at #1478

This could also be possible that some error was encountered and process ended in between, so try logging stdout too to check if thats the case.

The process completes, no issue with process, once you remove yarn.lock from tests, it passes which is strange and led me to conclude that it's an IO problem, 😕

Look at the commits being added to next branch that change the behavior of runInitWithAnswers after I added these tests. As init tests were passing in CI at that point of time.

No major changes

@alexander-akait
Copy link
Member

CI still broken 😞

@anshumanv
Copy link
Member Author

Checking @evilebottnawi 😄

@anshumanv
Copy link
Member Author

/cc @evilebottnawi

@alexander-akait alexander-akait merged commit f6ead01 into webpack:next Apr 28, 2020
@anshumanv anshumanv deleted the test/project-util branch April 28, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[test]: Add tests for utils to find project root
4 participants