vitest icon indicating copy to clipboard operation
vitest copied to clipboard

feat(vitest): add jest-like `Mock` type

Open hi-ogawa opened this issue 1 year ago • 1 comments

Description

  • closes https://github.com/vitest-dev/vitest/issues/4723
  • related https://github.com/vitest-dev/vitest/pull/4784

This is a non breaking version of https://github.com/vitest-dev/vitest/pull/4784 by exposing new jest-like Mock type under a separate namespace based on the suggestion https://github.com/vitest-dev/vitest/pull/4784#issuecomment-1871287808.

todo

  • is it okay to use __Mock to indicate these are internal things?
  • naming? (currently import { Mocks } from "vitest" and Mocks.Mock)
  • docs
    • https://vitest.dev/guide/migration.html#types

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • [x] Ideally, include a test that fails without this PR but passes with it.
  • [ ] Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • [ ] Run the tests with pnpm test:ci.

Documentation

  • [ ] If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • [x] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

hi-ogawa avatar Feb 08 '24 10:02 hi-ogawa

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
Latest commit a2ee61b9df9533bd0b24f1551844fb9ed1fd2ad9
Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65c567bd1045de0007ff806e
Deploy Preview https://deploy-preview-5152--fastidious-cascaron-4ded94.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Feb 08 '24 10:02 netlify[bot]

Closing in favor of #4784

sheremet-va avatar Mar 28 '24 09:03 sheremet-va