jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 244 forks source link

Fixtures with append=true can cause tests to be very slow #487

Open yairgo opened 8 years ago

yairgo commented 8 years ago

https://github.com/yairgo/teaspoon_spike

I've created a barebones repo with some tests.

I ran across this issue on accident. I have a project that has 10 test files and from the test report 79 tests. If you blindly follow this bit of code: https://github.com/modeset/teaspoon#example-usage your tests end up with append being true.

In my normal project, the 10 test files with 79 tests takes +45 seconds to run when append is true. When I changed append to false the tests go down to 2.28 seconds.

From what I can tell, the test runner ends up creating a queueableFn array for every test. With append set to true or false, the cleanup function gets added to each queueableFn array multiple times.

On my other project the number of times the cleanup function is called is +3000. I do not know why append being true or false makes a difference with the speed, but I do not think that the cleanup function should be added to each queueableFn more than once considering the queueableFn array represents one test.

mathieujobin commented 3 years ago

any idea if this is still valid?