redwood: [Bug?]: Scenarios broken with redwood 7
What’s not working?
We have some tests that fail after the update to redwood 7.
It seems, like “sub objects” in scenarios only get created some times and not every time as expected.
How do we reproduce the bug?
- Checkout https://github.com/razzeee/my-redwood-scenario-repro
- Run
yarn
- Run
yarn rw test api
What’s your environment? (If it applies)
System:
OS: Linux 6.7 Fedora Linux 39 (Workstation Edition)
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.10.0 - /tmp/xfs-e5f62a34/node
Yarn: 4.1.0 - /tmp/xfs-e5f62a34/yarn
Databases:
SQLite: 3.42.0 - /usr/bin/sqlite3
npmPackages:
@redwoodjs/core: 7.0.3 => 7.0.3
@redwoodjs/project-config: 7.0.3 => 7.0.3
Are you interested in working on this?
- I’m interested in working on this
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Comments: 15 (8 by maintainers)
@dac09 Unfortunately, I don’t have a ton of time to work on this now as I’m dealing with a family health crisis, but I noticed the following.
The issue appears to start when there are uncaught exceptions in the test code. This first block of code causes the following tests to fail on a scenario setup.
This second block of code does not cause the following tests to fail.
I haven’t had the chance to test it yet, but do we need a
try... catch
in the following function of jest.setup.js? Theawait teardown()
used to be in anafterEach()
function, but was moved into this test wrapper. We need to make sure that the teardown always happens.HTH!
I also noticed that if any test fails, the data in the database is not deleted and recreated, but only an attempt is made to create it again. This leads to a failure if your entity has a unique field like a
name
column. See my caseWhen a single test fails, subsequent tests will also fail with this error:
This, as I said, is because
name
is aunique
SQL column.Is anyone experiencing the same thing?
No, our tests were running just fine on v6 (or still are, as we haven’t updated due to this yet) But they fail with v7