-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
feat: better debug support #334
feat: better debug support #334
Conversation
Would introducing some kind of state machine pattern help? I feel like it's one of those problems that could be solved by this. |
Can you be more specific? |
Well, let's say that when pressing a particular button (like "start") has different effects in different states. Maybe when we are in the ContinuousRun state, that button does something else than when we are in another state. We can represent each state as a class implementing a particular interface with various inputs (onStartClicked) etc, and also allowing each state to control what other states are allowed to be switched to and from. It's similar to the strategy pattern in a way. I don't know the specifics of the problem, but it sounds like you're describing complex flows that apply differently in particular states. Can you describe the flows more detailed? Then I can come up with something probably. Alternatively, for me, it helps drawing it as a state machine on a piece of paper. |
And the pattern (you can create variants of it though): https://refactoring.guru/design-patterns/state |
I see what you mean now, but the problem here is not that we can't organize it, but that it's not possible to do several things at once - for example, you can't debug a test and collect other test files at the same time because Vitest only supports a single pool (it blocks other test runs until the current one is completed). |
9a62827
to
dbd5502
Compare
Then each state class can have a property called "canDebug" etc, to represent that. |
Again, this has nothing to do with the code architecture. We need to be able to collect tests despite the debugging, single Vitest instance just doesn't allow that. |
Ah I see. My bad. |
(doesn't work, but looks nice)
cb77ee5
to
271345d
Compare
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.
Beautiful. Great work! Minor optional suggestions and preferences.
This PR improves the debugger support by utilizing the new
inspector
option. Also, a new option was added:vitest.debuggerAddress
. With thevitest.debuggerPort
, I think we can close #185 now.Fixes #320
The debugger requires Vitest 1.5.0, but all other features work as they did with 1.4.0