Open AlexandreBonaventure opened 1 year ago
Thanks for reporting this bug and for the reproduction. I was able to verify the issue occurring with the repo you provided.
I'll route this to my team for further investigation.
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.
Is there a reason this ticket was closed? This issue is still occurring, but at least the OP's work around thankfully still works.
Thanks for the OP's work around, this still works for old cypress
Current behavior
Hello, I recently found a bug when modifying a response within listeners in
cy.intercept
when building a fixture system. The goal was to provide a command to progressively modify the API response.I had a hard time figuring it all out because the response I was expecting was only partly modified. Here's the repro steps: Using multiple interceptors, provide a fixture object in each listener that should be overriding the original response and previous fixtures.
When using
res.body = result
it only partly modify the original response. What is even more confusing is that:array: ['expected', 'expected']
was never defined in my fixture (onlyarray: ['expected']
). Likewisemessage
should be undefined here. Otherwise, all the other string fields were correctly modified. It makes me think that there is some kind of bug in the way mutations/merge results are handled in the interceptor logicI eventually ended up using Object.assign as a workaround which is working as expected, weirdly enough.
Thanks!
Desired behavior
res.body assignment
res.body = result
should behave the same way asObject.assign(res.body, result)
Test code to reproduce
https://github.com/AlexandreBonaventure/cypress-intercept-bug
Cypress Version
12.3.0
Node version
18.11.0
Operating System
MacOS 13.1
Debug Logs
No response
Other
No response