Closed sheremet-va closed 4 months ago
Would introducing some kind of state machine pattern help? I feel like it's one of those problems that could be solved by this.
Would introducing some kind of state machine pattern help?
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
We can represent each state as a class implementing a particular interface with various inputs
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).
Then each state class can have a property called "canDebug" etc, to represent that.
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.
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