fix: reject cy.intercept delay values >= 2^31#33377
fix: reject cy.intercept delay values >= 2^31#33377veeceey wants to merge 5 commits intocypress-io:developfrom
Conversation
|
|
@veeceey Thanks for the contribution! Could you please sign our CLA? |
|
Hi @jennifer-shehane, thanks for the heads up! I've just signed the CLA — could you trigger a recheck when you get a chance? Let me know if there's anything else needed. |
|
@veeceey The CLA is still not showing up as signed. I triggered a recheck. Sometimes the author of the commits does not match the email address on your GitHub account. Our CLA bot gets confused when they don't match - I'm not sure if that's what's happening here. Here are some solutions to fixing when commits are linked to the wrong user: https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/ |
|
Hey @jennifer-shehane, thanks for the recheck! I've verified the commits are authored with varun_6april@hotmail.com which is associated with my GitHub account. I tried signing the CLA again through the link — could you try one more recheck? If it still doesn't work, I can try amending the commits with my noreply GitHub email instead. |
|
recheck |
|
|
7bbd904 to
b76a958
Compare
|
Good catch on the notation! The |
…ser and can complete (cypress-io#33366) * fix: login attempts subsequent to a cancelled one now launch the browser and can complete * resolve cached responses with a bluebird promise instead of a native promise * adds typedefs for @cypress/request and extends interfaces so that api/index.ts can be better typed * correct type declaration in packages/server/lib/cloud/user.ts * clean up ts/package.json * changelog * rm expect-error directive and repalce with ignore - why is driver typechecking this? * changelog
setTimeout uses a signed 32-bit integer internally, so delay values >= 2^31 (~24.8 days) are silently coerced to 1ms. This causes the delay to be effectively ignored with no indication to the user. Add validation in validateStaticResponse to throw a clear error when delay >= 2^31, consistent with how throttleKbps is validated. Fixes cypress-io#33183
- Add changelog entry for delay validation to cli/CHANGELOG.md - Fix padding-line-between-statements lint error (blank line after const)
b76a958 to
b453d42
Compare
|
recheck |
|
Hi @jennifer-shehane -- just wanted to confirm the CLA is now showing as signed (the CLA check is passing green). The |
Problem
When
cy.interceptis used with adelayvalue >= 2^31 (2147483647ms, ~24.8 days), the delay is silently ignored becausesetTimeoutuses a signed 32-bit integer internally. Node.js coerces values >= 2^31 to 1ms, so the response is sent immediately instead of being delayed.While nobody probably needs a 24-day delay, this is confusing for anyone using very large values (like
Number.MAX_SAFE_INTEGER) to effectively "pause" a response indefinitely during testing.Fix
Added validation in
validateStaticResponseto throw a clear error whendelay >= 2147483647. This is consistent with howthrottleKbpsalready gets validated.The error message explains the limitation:
Testing
Added a test case to the existing
with invalid StaticResponsetest suite that verifies the error is thrown when delay exceeds the maximum.Fixes #33183