Skip to content

test: add reproduction case for missing AbortSignal reason#7443

Open
Janaka66 wants to merge 3 commits intoaxios:v1.xfrom
Janaka66:abort-reason-propagation
Open

test: add reproduction case for missing AbortSignal reason#7443
Janaka66 wants to merge 3 commits intoaxios:v1.xfrom
Janaka66:abort-reason-propagation

Conversation

@Janaka66
Copy link
Copy Markdown
Contributor

@Janaka66 Janaka66 commented Feb 25, 2026

🧪 Failing Test Case: Abort Reason Propagation

I have added a unit test that demonstrates how AxiosError fails to propagate the specific reason from an AbortController.

The Bug:
When a request is aborted with a specific reason (e.g., TimeoutError), Axios currently defaults the error message to 'canceled' instead of using the provided reason.

Test Outcome

  • Test File: test/unit/abort-reason.spec.js
  • Result: AssertionError [ERR_ASSERTION]: Expected values to be strictly equal
  • Actual: 'canceled'
  • Expected: 'TimeoutError'

🛠 Next Steps

I am currently working on the fix in lib/core/dispatchRequest.js (or relevant adapter) to ensure the reason property from the AbortSignal is correctly passed to the CanceledError constructor.


Summary by cubic

Adds a failing unit test to reproduce missing AbortSignal.reason propagation in Axios. It shows CanceledError uses "canceled" instead of the provided reason.

Description

Docs

  • No docs changes. Will update error handling docs after the fix if needed.

Testing

  • Added one failing unit test; no other tests changed.
  • Asserts e.code === "ERR_CANCELED" and e.message === "TimeoutError".

Written for commit 96bf5e3. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • This PR looks safe to merge overall; the only issue is a low-severity flaky test risk rather than product behavior.
  • test/unit/abort-reason.spec.js can intermittently fail because a real network request to a private IP may error before the 10ms abort, yielding a different error than expected.
  • Pay close attention to test/unit/abort-reason.spec.js - mitigate the race between network failure and abort to reduce flakiness.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="test/unit/abort-reason.spec.js">

<violation number="1" location="test/unit/abort-reason.spec.js:10">
P2: Test is flaky because it uses a real network request to a private IP and races it against a 10ms abort; the connection can fail immediately before aborting, yielding a network error instead of ERR_CANCELED.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread test/unit/abort-reason.spec.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant