readyWhen not honored on continuous target
#34040
Replies: 4 comments
-
|
same problem here with the @nx/vite executor. Vite executor build target config: dependent target: I have found a (slow) solution for this: Would love for this bug being fixed! |
Beta Was this translation helpful? Give feedback.
-
|
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
|
Hey, sorry this has sat for a long time. Nx's current design philosophy for continuous tasks does not provide a way for a task to mark itself as ready, with the idea that tasks that depend on a continuous task should have some way to check when that task is ready and have some builtin waiting / retries around that. This is similar to how playwright handles web servers. They start the underlying server immediately, and will start checking if the url you provided is available immediately and then start the tests when that condition is met. I'm going to close this out and transfer it to a discussion as a potential feature request, but its something we've discussed and the current thought train matches implementation. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the update. That's interesting, so I'm trying to figure out how that would work in my example. We've got an angular dev server that depends on a graphql codegen watchmode continuous task. How would I even add something to check for to the angular dev server. And what would it check? There might still be generated files from the previous run. How I've fixed it now is by doing the following: so marking watch-codegen as no longer continuous even though it is, and using an command array to make |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Current Behavior
When a target relies on a
continuoustarget that is configured withreadyWhen, thereadyWhenconfiguration of thecontinuoustarget is not honored and the specified target executes immediately, before thecontinuoustarget has met thereadyWhenconditions.Use Case: Test suite relies on
devtarget but must wait fordevto be ready before it starts to execute tests. Withdevconfigured ascontinuous, there needs to be a way to ensure that tests don't start untildevis fully ready. The only way that it appears nx supports this configuration is viareadyWhenbutreadyWhenis ignored whencontinuousis configured.Expected Behavior
readyWhenshould be honored forcontinuoustargets and targets that depend on thecontinuoustarget not started untilreadyWhenconditions are met.GitHub Repo
https://github.com/techfg/nx-21-continuous-tasks-repros
Steps to Reproduce
git clone https://github.com/techfg/nx-21-continuous-tasks-repros.gitnpx nx run waitForDevReadyWhenContinuousActual Behavior:
waitForDevReadyWhenContinuousstarts immediately and does not wait untildevReadyWhenContinuoushas met itsreadyWhenconditionsNx Report
Failure Logs
Package Manager Version
npm 10.9.2
Operating System
Additional Information
done, but the name of the option isreadyWhenso it's not 100% clear if this is supposed to indicate when a task is "done" or "ready". Given the name, the assumption is that when it's "ready" which would align with the use case described above as it relates tocontinuoustasks.npx nx run waitForDevReadyWhenwaits fordevReadyWhenas expected sincedevReadyWhenis not configured ascontinuousnx:run-commandsdoes not honorreadyWhenwhen only one command configured #31495non-continuoustargetwaitForDevthat dependsOn thecontinuoustargetdevand "polls" (e.g. checks a /health route for 200) and have the test target dependsOnwaitForDevinstead ofdev. While this works as needed, it's all unnecessary configuration andreadyWhenshould be honored regardless ofcontinuousconfiguration value (or another stock method to support this incredibly likely common use case added).Beta Was this translation helpful? Give feedback.
All reactions