hey, folks! I’m trying to set the jest config attribute testTimeout in my rw api.
I tried:
./jest.config.js in the project root
./api/jest.config.js
passing it as a flag like yarn rw test -- --testTimeout=10000
setting it as the last argument to the scenario function E.g. - scenario('returns all bills', /* test body callback */, 10000)
In most cases it seems to be ignored or maybe overwritten, but in the case of setting it in ./api/jest.config.js I do get a message saying the attribute is unknown.
● Validation Warning:
Unknown option "testTimeout" with value 10000 was found.
This is probably a typing mistake. Fixing it will remove this message.
I tried it both as a string and a number in this last case, just in case, but no love.
Glad you got the tests working, though I would have thought you could have set that in the projects config per side: Project Configuration | RedwoodJS Docs
Might I ask what tests could take 10s to run locally? Is there a root issue behind having to up the timeout we should be aware of?
It is odd that the tests run so slowly, but I’m not sure that’s redwood’s problem yet.
When I run with postgres in docker locally, the full suite of mostly generated tests, about 92 of them, completes in about 14 seconds.
When my TEST_DATABASE_URL points to postgres on AWS or on Railway, some tests are taking the ballpark of 8 seconds (hence the timeout at 5s).
The tests are pretty lightweight. I assumed it was some connection pool or similar config error I made.
What makes me think it could be something in rw is that it happens both on Railway and AWS.
Further weirdness, it has run successfully on Github Actions.
I thought it could be my network, but my bandwidth is good (E.g. - streaming video up and down, often multiple streams at once is normal and fine) and these tests are fetching like 2 rows of 8 columns of data or less.
Maybe something in the scenario seeding is blocking, or there’s just enough network latency to introduce a race condition that I don’t see locally?
Oh, one other thing I thought of and wanted to ask @ThomasGHenry – did you confirm that the test times out or was it ever the database connection timing out?