-
Notifications
You must be signed in to change notification settings - Fork 66
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
improve: expose projectRoot setting in createTestContext #1324
improve: expose projectRoot setting in createTestContext #1324
Conversation
Deploy request for graphql-nexus pending review. Review with commit 3698db4 |
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.
Thanks @luhagel!
One thing. Can you add some jsdoc for this option, mainly about why this setting might be used (like the other).
Will do |
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.
Thanks @luhagel!
Clarifying question. The search for package.json starts from cwd by default. If you were inside your package root I don't think there should be any issue, right? However if you're trying to run tests for a package from the monorepo root, then indeed that will not work.
Just want to make sure I'm understanding the problem.
@jasonkuhrt Exactly, the projectRoot and Our Jest suite runs from the monorepo root and executes all the suites across all the packages via jest projects. Since the |
Using
createTestContext
in a monorepo setting leads to theLayout.create
function detecting the top level package.json and error out because that one doesn't have it's own name. However, by exposing theprojectRoot
option already accepted byLayout.create
, we can circumvent this by resolving the path ahead of time, i.e.:TODO