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

tesugen

v1.1.3

Published

Setup extendable API-testing framework

Readme

Tesugen

Version 1.1.3

Setup your API-testing framework easily.

Use tesugen to setup API-testing framework in Typescript whenever you need it.

Make sure that you are running latest stable NodeJS (>= 14.6.0 LTS) and npm (>=7.6.1) version.

Table of Contents

Installation & Usage


Navigate to desired directory and run:

npx tesugen

You will be asked to choose your package manager, test runner, name your project and you will be ready to go.

Project-setup: Jest as selected test runner


Project-setup: TestyTS as selected test runner


Structure: Jest


  • src
    • routes
      • testRoutes.ts - Initial routes setup (Endpoints which will be the target)
    • client.ts - Initial test client setup
    • setup.ts - Initial test controller setup
    • testAgent.ts - Superagent initial setup
  • test - test folder where you can organize your tests
  • validation - validateResponse function for aditional contract/integration testing
  • .env - local environment file
  • .gitignore
  • index.ts
  • jest.config.js - Initial Jest config file (Generated only if the selected runner is Jest)

Create desired npm scripts to run specific tests:

"scripts": {
    "test": "jest ./test/functional/example",
    "test:basic": "jest ./test/basic/example"
  },

If you run jest in project root, Jest will by default look for all files with *.test.ts and run them if possible. To have everything running smoothly, testEnvironment and preset in jest.config.jest should be set by default:

preset: 'ts-jest',
testEnvironment: 'node',

Test reports will be generated in ./html-report in HTML format via Jest-html-reporters. Reporter can be configured in jest.config.js file. Jest supports multiple reporters. You can even create own custom reporter.

Structure: TestyTS


  • src
    • routes
      • testRoutes.ts - Initial routes setup (Endpoints which will be the target)
    • client.ts - Initial test client setup
  • test - test folder where you can organize your tests
  • validation - validateResponse function for aditional contract/integration testing
  • .env - local environment file
  • .gitignore

Create desired npm scripts to run specific tests:

"scripts": {
    "test": "testyts",
    "test:basic": "testyts ./test/basic/example"
  },

Test client


Test client can be configured and reused with no limitations. For testing multiple services, feel free to configure TestController to have multiple TestClient properties for every desired service.

Test client has four basic example methods for four HTTP methods: GET, POST, PUT and DELETE.

Class validator


Function located in ./validation/responseValidation.ts can be used for extended contract/integration testing. Make sure to create proper models according to desired response from your project documentation. To speed this process up, use any JSON to TS generator online to quickly convert JSON to TS interfaces/classes. Example: json2ts. Follow Class-validator documentation. Your tests will look like this:

expect(validateResponse(ProfileExampleResponse).toBeTruthy();

Base URL


is stored in your local .env file. This is also highly conigurable, you can adjust this to your project needs. Test credentials can also be stored in local .env file and be used for authorized endpoints. Supertest Agent supports setting headers:

supertest.agent(String(process.env.BASE_URL)).set({'Authorization':`${bearerToken}`}); 

Dotenv file example


BASE_URL=https://www.aaa.ccc

License