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

Comparing version 2.0.16 to 6.0.0

supertest/lib/agent.d.ts

76

supertest/index.d.ts

@@ -1,27 +0,21 @@

import * as superagent from "superagent";
import superagent = require("superagent");
import stAgent = require("./lib/agent");
import STest = require("./lib/test");
import { AgentOptions as STAgentOptions, App } from "./types";
export = supertest;
declare const supertest: supertest.SuperTestStatic;
declare function supertest(app: any, options?: supertest.Options): supertest.SuperTest<supertest.Test>;
declare namespace supertest {
interface Response extends superagent.Response {}
type Response = superagent.Response;
interface Request extends superagent.SuperAgentRequest {}
type Request = superagent.SuperAgentRequest;
type CallbackHandler = (err: any, res: Response) => void;
interface Test extends superagent.SuperAgentRequest {
app?: any;
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): this;
expect(status: number, body: any, callback?: CallbackHandler): this;
expect(checker: (res: Response) => any, callback?: CallbackHandler): this;
expect(body: string, callback?: CallbackHandler): this;
expect(body: RegExp, callback?: CallbackHandler): this;
expect(body: Object, callback?: CallbackHandler): this;
expect(field: string, val: string, callback?: CallbackHandler): this;
expect(field: string, val: RegExp, callback?: CallbackHandler): this;
end(callback?: CallbackHandler): this;
}
type CallbackHandler = superagent.CallbackHandler;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Test extends STest {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Agent extends stAgent {}
interface Options {

@@ -31,35 +25,15 @@ http2?: boolean;

interface AgentOptions extends Options {
ca?: any;
}
function agent(app?: any, options?: AgentOptions): SuperAgentTest;
type AgentOptions = STAgentOptions;
interface SuperTest<T extends superagent.SuperAgentRequest> extends superagent.SuperAgent<T> {}
interface SuperTestWithHost<T extends superagent.SuperAgentRequest> extends SuperTest<T> {
host(host: string): this;
type SuperTest<Req extends Test = Test> = superagent.SuperAgent<Req>;
type SuperAgentTest = SuperTest<Test>;
interface SuperTestStatic {
(app: App, options?: STAgentOptions): stAgent;
Test: typeof STest;
agent: typeof stAgent;
}
type SuperAgentTest =
& SuperTestWithHost<Test>
& Pick<
Request,
| "use"
| "on"
| "set"
| "query"
| "type"
| "accept"
| "auth"
| "withCredentials"
| "retry"
| "ok"
| "redirects"
| "timeout"
| "buffer"
| "serialize"
| "parse"
| "ca"
| "key"
| "pfx"
| "cert"
>;
}
export = supertest;
{
"name": "@types/supertest",
"version": "2.0.16",
"version": "6.0.0",
"description": "TypeScript definitions for supertest",

@@ -28,6 +28,8 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest",

"dependencies": {
"@types/cookiejar": "*",
"@types/methods": "*",
"@types/superagent": "*"
},
"typesPublisherContentHash": "3a50772627b3dc578ba000f0b0f17070659a1541d7eb962d2bc4b3f187d7d813",
"typeScriptVersion": "4.5"
"typesPublisherContentHash": "9b03caf6a8a3f608392439a874830990dc7aaaef48d55f79d19d59394245b60a",
"typeScriptVersion": "4.6"
}

@@ -9,76 +9,8 @@ # Installation

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest/index.d.ts)
````ts
import * as superagent from "superagent";
export = supertest;
declare function supertest(app: any, options?: supertest.Options): supertest.SuperTest<supertest.Test>;
declare namespace supertest {
interface Response extends superagent.Response {}
interface Request extends superagent.SuperAgentRequest {}
type CallbackHandler = (err: any, res: Response) => void;
interface Test extends superagent.SuperAgentRequest {
app?: any;
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): this;
expect(status: number, body: any, callback?: CallbackHandler): this;
expect(checker: (res: Response) => any, callback?: CallbackHandler): this;
expect(body: string, callback?: CallbackHandler): this;
expect(body: RegExp, callback?: CallbackHandler): this;
expect(body: Object, callback?: CallbackHandler): this;
expect(field: string, val: string, callback?: CallbackHandler): this;
expect(field: string, val: RegExp, callback?: CallbackHandler): this;
end(callback?: CallbackHandler): this;
}
interface Options {
http2?: boolean;
}
interface AgentOptions extends Options {
ca?: any;
}
function agent(app?: any, options?: AgentOptions): SuperAgentTest;
interface SuperTest<T extends superagent.SuperAgentRequest> extends superagent.SuperAgent<T> {}
interface SuperTestWithHost<T extends superagent.SuperAgentRequest> extends SuperTest<T> {
host(host: string): this;
}
type SuperAgentTest =
& SuperTestWithHost<Test>
& Pick<
Request,
| "use"
| "on"
| "set"
| "query"
| "type"
| "accept"
| "auth"
| "withCredentials"
| "retry"
| "ok"
| "redirects"
| "timeout"
| "buffer"
| "serialize"
| "parse"
| "ca"
| "key"
| "pfx"
| "cert"
>;
}
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
* Dependencies: [@types/superagent](https://npmjs.com/package/@types/superagent)
* Last updated: Thu, 21 Dec 2023 23:35:29 GMT
* Dependencies: [@types/cookiejar](https://npmjs.com/package/@types/cookiejar), [@types/methods](https://npmjs.com/package/@types/methods), [@types/superagent](https://npmjs.com/package/@types/superagent)
# Credits
These definitions were written by [Alex Varju](https://github.com/varju), and [Petteri Parkkila](https://github.com/pietu).
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