mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
f9cad15838
* chore(deps-dev): bump the development_dependencies group with 5 updates Bumps the development_dependencies group with 5 updates: | Package | From | To | | --- | --- | --- | | [@vitest/browser](https://github.com/vitest-dev/vitest/tree/HEAD/packages/browser) | `4.1.5` | `4.1.6` | | [@vitest/browser-playwright](https://github.com/vitest-dev/vitest/tree/HEAD/packages/browser-playwright) | `4.1.5` | `4.1.6` | | [fs-extra](https://github.com/jprichardson/node-fs-extra) | `11.3.4` | `11.3.5` | | [playwright](https://github.com/microsoft/playwright) | `1.59.1` | `1.60.0` | | [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `4.1.5` | `4.1.6` | Updates `@vitest/browser` from 4.1.5 to 4.1.6 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.6/packages/browser) Updates `@vitest/browser-playwright` from 4.1.5 to 4.1.6 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.6/packages/browser-playwright) Updates `fs-extra` from 11.3.4 to 11.3.5 - [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md) - [Commits](https://github.com/jprichardson/node-fs-extra/compare/11.3.4...11.3.5) Updates `playwright` from 1.59.1 to 1.60.0 - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.59.1...v1.60.0) Updates `vitest` from 4.1.5 to 4.1.6 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.6/packages/vitest) --- updated-dependencies: - dependency-name: "@vitest/browser" dependency-version: 4.1.6 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development_dependencies - dependency-name: "@vitest/browser-playwright" dependency-version: 4.1.6 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development_dependencies - dependency-name: fs-extra dependency-version: 11.3.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development_dependencies - dependency-name: playwright dependency-version: 1.60.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development_dependencies - dependency-name: vitest dependency-version: 4.1.6 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development_dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump packages * chore: package lock update --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jay <jasonsaayman@gmail.com>
Test Contribution Guide
This guide explains how to contribute tests inside the tests directory.
It is intentionally scoped to this directory only.
Tests Directory Layout
tests/
browser/ # browser runtime tests
setup/ # shared test setup utilities
smoke/ # package-compat smoke suites (esm + cjs)
unit/ # focused unit/behavior tests
Use the runtime-first layout already present in this directory:
- Put browser-runtime behavior in
tests/browser. - Put non-browser focused tests in
tests/unit. - Put packaging/compatibility smoke checks in
tests/smoke/esm/testsandtests/smoke/cjs/tests. - Reuse helpers from
tests/setupinstead of duplicating setup logic.
File Naming Conventions
Follow the existing file patterns:
- Unit tests:
*.test.js - Browser tests:
*.browser.test.js - ESM smoke tests:
*.smoke.test.js - CJS smoke tests:
*.smoke.test.cjs
When adding a new test, match the nearest existing file name pattern in the same subdirectory.
Suite-Specific Authoring Patterns
Unit (tests/unit)
- Keep tests focused on one behavior or API surface.
- For adapter/network behavior, prefer local test servers using utilities from
tests/setup/server.js. - Ensure server cleanup with
try/finallyso tests do not leak resources. - Keep fixtures close to the tests that use them (see
tests/unit/adaptersfor examples).
Representative files:
tests/unit/adapters/http.test.jstests/unit/adapters/fetch.test.jstests/unit/regression.test.js
Browser (tests/browser)
- Use local in-file
MockXMLHttpRequeststyle mocks when testing request behavior. - Replace global XHR in
beforeEachand restore it inafterEach. - Reset spies/mocks in cleanup hooks to keep tests isolated.
- Keep assertions centered on observable request/response behavior.
Representative files:
tests/browser/requests.browser.test.jstests/browser/adapter.browser.test.jstests/browser/defaults.browser.test.js
Smoke (tests/smoke)
- Keep ESM and CJS smoke coverage aligned for compatibility-sensitive behavior.
- If you add a new smoke scenario in one format, add the equivalent in the other format.
- Keep smoke tests small and focused on import/runtime behavior and critical request flows.
Representative files:
tests/smoke/esm/tests/fetch.smoke.test.jstests/smoke/cjs/tests/fetch.smoke.test.cjstests/smoke/esm/tests/basic.smoke.test.jstests/smoke/cjs/tests/basic.smoke.test.cjs
Shared Setup Utilities (tests/setup)
Use shared helpers before introducing new setup code:
tests/setup/server.js- Server lifecycle helpers:
startHTTPServer,stopHTTPServer,stopAllTrackedHTTPServers - Timing helpers:
setTimeoutAsync - Data/stream helpers used by adapter tests
- Server lifecycle helpers:
tests/setup/browser.setup.js- Browser cleanup hook (
afterEach) for clearing test DOM state
- Browser cleanup hook (
General expectation: if a helper can be reused by multiple tests in this directory, add or extend it in tests/setup instead of copying setup code between test files.
Fixtures and Test Data
- Prefer colocated fixtures near the test files that need them.
- Keep fixture names explicit and stable.
- For matrix-like scenarios, prefer concise table-driven cases inside the test file when practical.
Examples of colocated fixtures:
tests/unit/adapters/cert.pemtests/unit/adapters/key.pemtests/unit/adapters/axios.png
Contributor Checklist
Before opening a PR for tests in this directory:
- File is placed in the correct suite directory (
unit,browser, orsmoke). - File name matches the local pattern (
*.test.js,*.browser.test.js,*.smoke.test.js,*.smoke.test.cjs). - Test setup/teardown is explicit and leaves no global/server state behind.
- Shared setup logic uses
tests/setuphelpers where possible. - Smoke tests remain ESM/CJS consistent when behavior is format-sensitive.
- Fixtures are colocated and minimal.
- Assertions are deterministic and avoid unnecessary timing/network flakiness.