-
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
Slow per-file startup #2268
Comments
OK, I guess you can put that down as a (minor) feature request :) Also in the mix, I forgot to mention, If I use |
It would probably include the delay added by |
We've also noticed a significant delay between test files in ava 3.8.2. We have 150 test files and 1300 tests and we notice that ~10min is spent running test files and ~6min is spent in overhead. I measured "time spent running a test" by profiling https://github.com/avajs/ava/blob/master/lib/runner.js#L378 and "overhead" by subtracting time spent from total time for the whole suite measured by my system. Our tests could be the cause of this delay(I'm guessing something could prevent the test process from terminating?), but it would be nice to get a warning from ava if there is a significant delay between tests. |
@shusson that doesn't sound too great! It would really help if we could pin down where the time is being spent. For instance, instrumenting that You're not using things like |
Yeah we are still investigating, I will post an update when we have one.
No, we transpile all our typescript and run ava against the js. |
Thanks. There can be many variables at play here. I have a test suite with 34 files / 500 tests which runs really smoothly… |
@novemberborn Our delay happens when ava requires each test file here: https://github.com/avajs/ava/blob/master/lib/worker/subprocess.js#L190. I guess this is the price we pay for test file isolation and having a ~400 dependencies :( It might be useful for others to have ava log a warning if the require takes longer than 1 second. |
Right so it's the bootstrap time of your (test) dependencies, plus then declaring the tests. I agree it may be useful to report that… maybe if the time spend just loading the test file is over a certain percentage of total run time? If only so that, uhm — and I know you weren't doing this — AVA isn't blamed 😉 This I think is the one use case for letting you run all test files in a single process / thread, so that you can better utilize caches. As long as tests don't have side-effects in the process itself. |
:D I would rephrase it to: "AVA helping you discover that your app takes forever to load dependencies"
yes one of the reasons we migrated to AVA was jestjs/jest#8331 |
It looks like there used to be debug tooling to enable this that was removed in 2018. |
[Sorry pressed the submit button prematurely by mistake]
I'm running all my tests serially, with only one process at a time, i.e.:
(Because most all tests need access to a local server that doesn't support concurrent requests... #2048 would fix that!)
And I see a several-second delay before each file's tests start running.
I'm compiling my sources as per https://github.com/avajs/ava/blob/master/docs/recipes/babel.md#compile-sources so that is likely contributing/causing. But I'd expect the cacheing mechanism to minimize the need to recompile?
Is there any way I can trace what's going on to prepare each file so I can see where the time is being spent and what if any optimizations I could look into?
Thanks!
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:
The text was updated successfully, but these errors were encountered: