Socket
Socket
Sign inDemoInstall

@types/supertest

Package Overview
Dependencies
5
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/supertest

TypeScript definitions for supertest


Version published
Weekly downloads
2.9M
decreased by-18.21%
Maintainers
1
Install size
3.89 MB
Created
Weekly downloads
 

Package description

What is @types/supertest?

The @types/supertest package provides TypeScript type definitions for the Supertest library, which is a SuperAgent driven library for testing HTTP servers. These type definitions allow developers to use Supertest in TypeScript projects with the benefits of type checking and IntelliSense in their code editors.

What are @types/supertest's main functionalities?

HTTP Assertions

This feature allows you to make HTTP assertions with Supertest. The code sample demonstrates how to test a GET request to '/user' endpoint expecting a JSON response and a 200 status code.

import supertest from 'supertest';
import app from './app';

describe('GET /user', () => {
  it('responds with json', (done) => {
    supertest(app)
      .get('/user')
      .expect('Content-Type', /json/)
      .expect(200, done);
  });
});

Type Checking

This feature provides type checking for Supertest objects. The code sample shows how to create a typed Supertest instance and use it to make a GET request.

import supertest, { SuperTest, Test } from 'supertest';
import app from './app';

const request: SuperTest<Test> = supertest(app);

request.get('/user').expect(200);

Other packages similar to @types/supertest

Readme

Source

Installation

npm install --save @types/supertest

Summary

This package contains type definitions for supertest (https://github.com/visionmedia/supertest).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest.

Additional Details

Credits

These definitions were written by Alex Varju, Petteri Parkkila, and David Tanner.

FAQs

Last updated on 27 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc