npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jest-rest-docs

v1.0.1

Published

A Jest plugin for generating OpenAPI documentation from API tests.

Downloads

21

Readme

jest-rest-docs

소개

이 프로젝트는 Jest 기반의 API 테스트를 실행하면서 자동으로 OpenAPI 문서를 생성해주는 도구입니다.

사용법

1. 테스트 작성

tests/integration/example-api.test.ts 파일을 참고하여, 다음과 같이 테스트를 작성하세요:

import { docs } from '../setup/setup';

describe('User API Integration Tests', () => {
  it('should create a new user', async () => {
    await docs.test({
      method: 'POST',
      path: '/api/users',
      metadata: {
        tags: ['Users'],
        summary: '새로운 사용자 생성',
        description: '신규 사용자를 생성합니다.',
      },
      callback: async (request) => {
        const response = await request
          .post('/api/users')
          .send({ name: '홍길동', email: '[email protected]' })
          .expect(201);
      },
    });
  });
});

2. 테스트 실행

npm test

3. 결과 문서 확인

  • 테스트가 끝나면 docs/openapi.json 파일이 자동으로 생성됩니다.
  • 임시 파일은 docs/temp-docs 폴더에 저장되며, 테스트 종료 후 자동으로 정리됩니다.

폴더 구조

  • docs/openapi.json : 최종 OpenAPI 문서
  • docs/temp-docs/ : 테스트 중간에 생성되는 임시 파일 (자동 정리)
  • tests/integration/example-api.test.ts : 예시 테스트 코드
  • tests/setup/setup.ts : JestRestDocs 인스턴스 및 서버 설정
  • tests/setup/teardown.ts : 테스트 종료 후 문서 병합 및 임시 파일 정리

기타

  • outputDir, tempDir 등은 모두 docs 하위로 고정되어 있습니다.
  • 기존 openapi.json이 없거나 비어있어도 정상 동작합니다.
  • 테스트를 추가하고 싶으면 example-api.test.ts를 복사해서 사용하세요.

문의사항은 이슈로 남겨주세요!