Détail du package

@fetch-mock/vitest

wheresrhys142.4kMIT0.2.15

Vitest wrapper for fetch-mock

fetch, http, mock, testing

readme

@fetch-mock/vitest

A wrapper for fetch-mock that improves the developer experience when working with vitest. It provides the following:

  • Adds methods to fetchMock which wrap its default methods, but align more closely with vitest's naming conventions.
  • Extends expect with convenience methods allowing for expressive tests such as expect(fetchMock).toHavePosted('http://example.com', {id: 'test-id'}).
  • Can optionally be hooked in to vitest's global mock management methods such as clearAllMocks().

Requirements

@fetch-mock/vitest requires either of the following to run:

  • vitest
  • The fetch API, via one of the following:
    • Node.js 18+ for full feature operation
    • Any modern browser that supports the fetch API
    • node-fetch when testing in earlier versions of Node.js (this is untested, but should mostly work)

Documentation and Usage

See the project website

License

@fetch-mock/vitest is licensed under the MIT license. Copyright © 2024, Rhys Evans

changelog

Changelog

0.2.15 (2025-08-28)

Bug Fixes

  • make compatible with browser builds using cjs (4b174d0)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.5.3 to ^12.5.4

0.2.14 (2025-06-17)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.5.2 to ^12.5.3

0.2.13 (2025-03-03)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.5.1 to ^12.5.2

0.2.12 (2025-03-01)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.5.0 to ^12.5.1

0.2.11 (2025-03-01)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.4.0 to ^12.5.0

0.2.10 (2025-02-23)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.3.0 to ^12.4.0

0.2.9 (2025-02-23)

Features

  • WIP vitest wrapper types (0f922f3)

Bug Fixes

  • export vitest expect extension types properly (f8aa579)
  • only import types, not implementation, from vitest types (a8d442b)

0.2.8 (2025-02-04)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.2.1 to ^12.3.0

0.2.7 (2025-01-28)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.2.0 to ^12.2.1

0.2.6 (2024-11-15)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.1.0 to ^12.2.0

0.2.5 (2024-11-08)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from ^12.0.3 to ^12.1.0

0.2.4 (2024-11-08)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from 12.0.2 to 12.0.3

0.2.3 (2024-10-30)

Bug Fixes

  • use file extension to avoid import errors for vitest and jest wrappers (f1f25f1)

0.2.2 (2024-10-28)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from 12.0.1 to 12.0.2

0.2.1 (2024-10-27)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from 12.0.0 to 12.0.1

0.2.0 (2024-10-24)

⚠ BREAKING CHANGES

  • Replaced legacy fetch-mock code with fetch-mock/core code

Features

  • Replaced legacy fetch-mock code with fetch-mock/core code (999ce92)

Documentation Changes

  • bring vitest docs into website (22b549b)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • fetch-mock bumped from 11.1.5 to 12.0.0

0.1.5 (2024-09-25)

Bug Fixes

  • change export order so default is last (bc9c41d)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @fetch-mock/core bumped from ^0.7.0 to ^0.7.1

0.1.4 (2024-08-31)

Bug Fixes

  • applied same type fixes to vitest wrapper (817af39)

0.1.3 (2024-08-30)

Bug Fixes

  • force engine to be >=18.11.0 as this fixes an issue in proxying a response (dde5e6b)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @fetch-mock/core bumped from ^0.6.3 to ^0.7.0

0.1.2 (2024-08-29)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @fetch-mock/core bumped from ^0.6.2 to ^0.6.3

0.1.1 (2024-08-29)

Bug Fixes

  • add missing metadata to package.json files (4ab78b9)

Documentation Changes

  • add vitest as keyword to vitest package (9d6636e)

0.1.0 (2024-08-28)

Bug Fixes

  • add missing metadata to package.json files (4ab78b9)

Documentation Changes

  • add vitest as keyword to vitest package (9d6636e)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @fetch-mock/core bumped from ^0.6.0 to ^0.6.2

0.1.0 (2024-08-28)

Features

  • start implementing jest and vitest wrappers (804f885)