Closed jamiebuilds closed 4 years ago
Interesting. Do you see this as a side-kick that runs in the main AVA process, without needing a complete programmatic API? The changes in #1722 would come in handy for this.
I could either use it in the main process or as another process that Ava starts up. I figure it's a little easier to build in the main process though.
I don't think it needs much of a programmatic API, maybe that can be expanded upon in the future.
It might be interesting to expose some way to start or stop a test run or control what tests are being run based on some other logic. You could build an entire UI around Ava
Cool, I'm 👍 on this.
We'd need to decide what configuration syntax is used to load this module. I think it's fine if it's restricted to configuration files only. It shouldn't be something you do on a one-off basis.
esm
ava
object should include the version number for compatibility purposesWhat test results are you interested in? I'm loath to expose AVA's internals, at least at this stage, since I don't think that has necessarily stabilized yet.
Modified from: https://github.com/avajs/ava/issues/1768#issuecomment-381214630
type Data = {
...,
snapshots: Array<{
name: string,
expected: any,
actual: any,
passed: boolean
}>
};
ava.on('complete', (data: Data) => {
browserWs.send(JSON.stringify(data.failedSnapshots));
});
This is basically all I care about. As long as I can get a list of the snapshots that failed in a way that I could later tell Ava to go update them, that would be enough for me
That's not really the data we communicate back to the main process. What we can expose now:
The latter is a string. We could also provide the concordance
-serialized value, but I worry that might be unnecessarily expensive so may have to be an opt-in.
If we also expose a function for resolving the snapshot location based on the test file, you'd have enough to build on top of.
Could I subscribe to specifically snapshots?
We have various issues about running all assertions, and communicating all assertion results up to the main process: #261, #1356, #1330, #324. I'd be more than happy to expose those to this side-kick. You could then filter out the snapshots.
The work I'm doing with https://github.com/avajs/ava/pull/2478 will allow us to run a worker thread. That said, I don't think our internal events are stable enough to expose to user code.
It's been two years since this was opened, I don't think we'll get to this for a while still, so I'm going to close this issue, sorry.
Description
I'm trying to build some tooling that runs alongside Ava, I can run it as a separate process, but I need to setup my own file watcher and do lots of work to make it work well alongside Ava.
It would be great if Ava exposed a hook to:
Rough draft: