-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[WIP] Run tests in a single process #1645
Conversation
0b3fec6
to
e943264
Compare
e943264
to
4f73828
Compare
What do you think about still running the tests in a separate worker process, but reusing that process? |
Interesting idea, I think it would help with correct console.log() handling. |
It also protects the main process from any shenanigans the tests may be up to. We'd still get process concurrency. |
I think reusing could be useful for multi-process too, but this PR should focus on only the same process. The use-cases are things that need to be run in the same process as the AVA CLI, for example, debugging or Electron. So I'd rather have multi-process mode reuse processes and let this one be without any process forking. If users want reuse of a single process, they can just set |
Interesting, we can start with top-level process then. I think rather than mimicking the rather low-level |
I've been doing a fair bit of refactoring in this area, and have some ideas on how to make |
That doesn't sound like an easier way to implement this right now to me :) This PR isn't that complex, is it? What improvements specifically do you have in mind? |
Getting rid of the various events that are emitted and forwarded and rewritten and reemitted, as well as the stats counting and test tracking we do all over the place. |
But this PR doesn't change events, it just switches |
I'd really like this to be a first class implementation, rather than a mimicking of how I have been doing and will continue to do refactoring to clear up the existing code, and hopefully that makes it relatively straight-forward to do that first class implementation. It's definitely in the back of my mind. |
Definitely agree with this. Ok then, we can put this PR on hold for now, I'm super busy lately anyway. |
Hey @vadimdemedes, this is quite outdated by now. Going to close if you don't mind 😄 |
@novemberborn Of course ;) |
Fixes #1332.
Note, that there's no sandboxing like in Jest. This PR runs tests in the same AVA process, similar to Mocha. Feel free to try it out in your own projects, propose better solutions/code and generally tell us what you think.
TODO:
console.log()
and send its args tolib/fork
for proper output, like in fork mode. I'd rather support Make t.log() behave like console.log() #1635 instead.lib/process-adapter
).@std/esm
support (doesn't work, becauselib/main
doesn't have access tomodule.parent.parent
, which isundefined
).