vitest icon indicating copy to clipboard operation
vitest copied to clipboard

add JSDoc to Vitest code

Open yukulele opened this issue 1 year ago • 3 comments

Clear and concise description of the problem

Vitest functions have little or no documentation in the code, making them difficult to use and adopt.

This is what the editor shows me: Screenshot_20240213_110246

and this is what I hope to see: Screenshot_20240213_105833

Suggested solution

add JSDoc to Vitest code

Alternative

I have to go to the documentation every time I'm not sure how to use a function :/

Additional context

No response

Validations

yukulele avatar Feb 13 '24 10:02 yukulele

hey folks, I'd like to take a look on it to get familiarized with the project. would you guys have any clue? I've been searching for where jsdocs are added in expect packages but I could not find yet.

geeksilva97 avatar Jun 18 '24 03:06 geeksilva97

You can add jsdoc to the type definition here https://github.com/vitest-dev/vitest/blob/f969fb0f9f0247a7daa2afee8f70de25ea5e123f/packages/expect/src/types.ts#L116-L164

For example,

  /**
   * write something...
   * @example
   *   expect("xxx").toEqual("xxx") // OK
   */
  toEqual: <E>(expected: E) => void

image

hi-ogawa avatar Jun 18 '24 04:06 hi-ogawa

Thanks a lot man!

geeksilva97 avatar Jun 18 '24 13:06 geeksilva97