-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
createProjectGraph() doesn't work using runNxCommandAsync() #5065
Comments
Oh, yeah. I thought, well, heck, I should just copy over the tests that clearly work in the nx repo.
The dev tools work is great. I could see a lot more adoption by my teams. I think it would help to have more results in the tools. How do you get the tree for My end goal is to check dependencies for some stages of my build process. When I saw what was happening in @nrwl/node I was thinking, "oh, making sure you have built the supporting packages... smart".... |
I've just been caught out by this as well. e2e testing my plugin, I call |
Fwiw, the Also I see the same issue if I run my executor from the command line, so it doesnt seem to be a test environment thing. |
Ok a bit more digging... (apologies if streamed updates are not conventional) These do not return the correct objects when called inside my executor - If I log them, I see right away they are the parent workspace, not the e2e workspace.
|
Ok setting environment variable |
ok this is strange: (my plugin is correctly installed in the |
And now of course I realize the e2e workspace not sure where to go next with this. :/ |
@Brian-McBride I've monkey patched a solution for now. In my plugin executor (or whereever) I import the following module, which checks if cwd is an
In your plugin executor as the first import (before calling anything that sets |
Also, linking to a related issue #4157 |
@Brian-McBride Does this still occur w/ latest Nx? |
@AgentEnder I haven't had the time to test it. I created an e2e test around the issue and haven't thought about it since. |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
@AgentEnder this issue still exists for me in Nx 13.9.4. In my case exposed when running e2e tests that invoke a custom build executor (we have been chatting about this over on Slack). Setting |
For various reasons I had to regress a workspace to nx 13.10.6 and got hit by this issue again, gah. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
I am using the plugin generator.
Overall, the generator seems really easy to use. Out of the box, it works.
Then, I want to follow the conventions set up in
@nrwl/node
as I'm doing a builder very similar. Of course, the e2e tests are way more complicated there. And might know whyIf you just try to do this:
The
projGraph
value will be set to the outer project, not the generated./tmp/nx-e2e/proj
where it is expected.Expected Behavior
Within e2e tests,
createProjectGraph
should return data about the testing project, not the parent plugin project.Steps to Reproduce
I think the sample above shows the code.
Just use the nx tools to create new plugin library, then, then try to use
createProjectGraph
when running your e2e tests. You'll see that it give you the graph for the root project, not the temp one you created in the temp folder.My guess, based not eh completely different test code running in the @nrwlnode tests, is that the CWD is not being set correctly somewhere in that pipeline.
The text was updated successfully, but these errors were encountered: