diff --git a/types/blue-tape/package.json b/types/blue-tape/package.json index 0681d9d0aefc57..609f78967fabd2 100644 --- a/types/blue-tape/package.json +++ b/types/blue-tape/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@types/node": "*", - "@types/tape": "*" + "@types/tape": ">=2.0.0 <5.0.0" }, "devDependencies": { "@types/blue-tape": "workspace:.", diff --git a/types/cwise-parser/package.json b/types/cwise-parser/package.json index 2f24216e30a71e..06191889758741 100644 --- a/types/cwise-parser/package.json +++ b/types/cwise-parser/package.json @@ -7,7 +7,7 @@ ], "devDependencies": { "@types/cwise-parser": "workspace:.", - "@types/tape": "*" + "@types/tape": "^4.0.0" }, "owners": [ { diff --git a/types/cwise/package.json b/types/cwise/package.json index ba2ddb5378718d..56de3db8960e38 100644 --- a/types/cwise/package.json +++ b/types/cwise/package.json @@ -13,7 +13,7 @@ "@types/browserify": "*", "@types/cwise": "workspace:.", "@types/node": "*", - "@types/tape": "*" + "@types/tape": "^4.0.0" }, "owners": [ { diff --git a/types/node/http2.d.ts b/types/node/http2.d.ts index a90444ced72c1b..a026ef506e2fce 100644 --- a/types/node/http2.d.ts +++ b/types/node/http2.d.ts @@ -20,6 +20,7 @@ declare module "node:http2" { ":method"?: string | undefined; ":authority"?: string | undefined; ":scheme"?: string | undefined; + ":protocol"?: string | undefined; } // Http2Stream interface StreamState { diff --git a/types/node/v20/http2.d.ts b/types/node/v20/http2.d.ts index 1f0c4e2a0ed4e0..7e77059b337b5b 100644 --- a/types/node/v20/http2.d.ts +++ b/types/node/v20/http2.d.ts @@ -31,6 +31,7 @@ declare module "http2" { ":method"?: string | undefined; ":authority"?: string | undefined; ":scheme"?: string | undefined; + ":protocol"?: string | undefined; } // Http2Stream export interface StreamPriorityOptions { diff --git a/types/node/v22/http2.d.ts b/types/node/v22/http2.d.ts index a08c686629591a..4937d8aa3a595b 100644 --- a/types/node/v22/http2.d.ts +++ b/types/node/v22/http2.d.ts @@ -31,6 +31,7 @@ declare module "http2" { ":method"?: string | undefined; ":authority"?: string | undefined; ":scheme"?: string | undefined; + ":protocol"?: string | undefined; } // Http2Stream export interface StreamPriorityOptions { diff --git a/types/node/v24/http2.d.ts b/types/node/v24/http2.d.ts index a175720a9f5c9d..84b78fb6e22859 100644 --- a/types/node/v24/http2.d.ts +++ b/types/node/v24/http2.d.ts @@ -31,6 +31,7 @@ declare module "http2" { ":method"?: string | undefined; ":authority"?: string | undefined; ":scheme"?: string | undefined; + ":protocol"?: string | undefined; } // Http2Stream export interface StreamState { diff --git a/types/nodemailer/lib/mailer/index.d.ts b/types/nodemailer/lib/mailer/index.d.ts index 38e6e71c4d9f10..0023b47f0c753f 100644 --- a/types/nodemailer/lib/mailer/index.d.ts +++ b/types/nodemailer/lib/mailer/index.d.ts @@ -27,8 +27,11 @@ declare namespace Mail { type TextEncoding = "quoted-printable" | "base64"; + /** Most reliable way to represent an email address with optional name. Nodemailer handles all the escaping and formatting automatically, forming `Name ` strings. */ interface Address { - name: string; + /** Name part of `Name ` address; if falsey, only the email address will be used */ + name?: string | undefined; + /** Email part of `Name ` address; technically optional, but Nodemailer ignores address-less objects, so we require it to help prevent bugs. */ address: string; } diff --git a/types/nodemailer/nodemailer-tests.ts b/types/nodemailer/nodemailer-tests.ts index 967dde403b3acd..5c706297c791de 100644 --- a/types/nodemailer/nodemailer-tests.ts +++ b/types/nodemailer/nodemailer-tests.ts @@ -131,6 +131,20 @@ function message_common_fields_array_test() { }; } +function message_common_fields_optional_address_object_test() { + const message: Mail.Options = { + from: { address: "sender@server.com" }, + to: [{ name: "Receiver", address: "receiver@sender.com" }, { address: "receiver2@sender.com" }], + cc: { name: "Carbon Copy", address: "cc@sender.com" }, + bcc: { address: "bcc@sender.com" }, + }; + + const missingAddress: Mail.Options = { + // @ts-expect-error - Nodemailer ignores address-less objects, so the type requires address. + to: { name: "Receiver" }, + }; +} + // More advanced fields function message_more_advanced_fields_test() { diff --git a/types/nodemailer/v6/lib/mailer/index.d.ts b/types/nodemailer/v6/lib/mailer/index.d.ts index 6bd18f629e16d5..3741a2e32e8a7d 100644 --- a/types/nodemailer/v6/lib/mailer/index.d.ts +++ b/types/nodemailer/v6/lib/mailer/index.d.ts @@ -27,8 +27,11 @@ declare namespace Mail { type TextEncoding = "quoted-printable" | "base64"; + /** Most reliable way to represent an email address with optional name. Nodemailer handles all the escaping and formatting automatically, forming `Name ` strings. */ interface Address { - name: string; + /** Name part of `Name ` address; if falsey, only the email address will be used */ + name?: string | undefined; + /** Email part of `Name ` address; technically optional, but Nodemailer ignores address-less objects, so we require it to help prevent bugs. */ address: string; } diff --git a/types/nodemailer/v6/nodemailer-tests.ts b/types/nodemailer/v6/nodemailer-tests.ts index 19520d82848da4..989e5079408287 100644 --- a/types/nodemailer/v6/nodemailer-tests.ts +++ b/types/nodemailer/v6/nodemailer-tests.ts @@ -109,6 +109,20 @@ function message_common_fields_test() { }; } +function message_common_fields_optional_address_object_test() { + const message: Mail.Options = { + from: { address: "sender@server.com" }, + to: [{ name: "Receiver", address: "receiver@sender.com" }, { address: "receiver2@sender.com" }], + cc: { name: "Carbon Copy", address: "cc@sender.com" }, + bcc: { address: "bcc@sender.com" }, + }; + + const missingAddress: Mail.Options = { + // @ts-expect-error - Nodemailer ignores address-less objects, so the type requires address. + to: { name: "Receiver" }, + }; +} + // More advanced fields function message_more_advanced_fields_test() { diff --git a/types/nodemailer/v7/lib/mailer/index.d.ts b/types/nodemailer/v7/lib/mailer/index.d.ts index 38e6e71c4d9f10..0023b47f0c753f 100644 --- a/types/nodemailer/v7/lib/mailer/index.d.ts +++ b/types/nodemailer/v7/lib/mailer/index.d.ts @@ -27,8 +27,11 @@ declare namespace Mail { type TextEncoding = "quoted-printable" | "base64"; + /** Most reliable way to represent an email address with optional name. Nodemailer handles all the escaping and formatting automatically, forming `Name ` strings. */ interface Address { - name: string; + /** Name part of `Name ` address; if falsey, only the email address will be used */ + name?: string | undefined; + /** Email part of `Name ` address; technically optional, but Nodemailer ignores address-less objects, so we require it to help prevent bugs. */ address: string; } diff --git a/types/nodemailer/v7/nodemailer-tests.ts b/types/nodemailer/v7/nodemailer-tests.ts index 967dde403b3acd..5c706297c791de 100644 --- a/types/nodemailer/v7/nodemailer-tests.ts +++ b/types/nodemailer/v7/nodemailer-tests.ts @@ -131,6 +131,20 @@ function message_common_fields_array_test() { }; } +function message_common_fields_optional_address_object_test() { + const message: Mail.Options = { + from: { address: "sender@server.com" }, + to: [{ name: "Receiver", address: "receiver@sender.com" }, { address: "receiver2@sender.com" }], + cc: { name: "Carbon Copy", address: "cc@sender.com" }, + bcc: { address: "bcc@sender.com" }, + }; + + const missingAddress: Mail.Options = { + // @ts-expect-error - Nodemailer ignores address-less objects, so the type requires address. + to: { name: "Receiver" }, + }; +} + // More advanced fields function message_more_advanced_fields_test() { diff --git a/types/tape-async/package.json b/types/tape-async/package.json index 83e92d0365fb21..8a681154d3e803 100644 --- a/types/tape-async/package.json +++ b/types/tape-async/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@types/node": "*", - "@types/tape": "*" + "@types/tape": "^4.5.0" }, "devDependencies": { "@types/tape-async": "workspace:." diff --git a/types/tape-catch/package.json b/types/tape-catch/package.json index 68edce2c49513d..93e8a762b0ef9c 100644 --- a/types/tape-catch/package.json +++ b/types/tape-catch/package.json @@ -6,7 +6,7 @@ "https://github.com/michaelrhodes/tape-catch" ], "dependencies": { - "@types/tape": "*" + "@types/tape": "~4.13.0" }, "devDependencies": { "@types/node": "*", diff --git a/types/tape-promise/package.json b/types/tape-promise/package.json index 53d9ae9a8f9fde..4210a6c92bbb1b 100644 --- a/types/tape-promise/package.json +++ b/types/tape-promise/package.json @@ -6,7 +6,7 @@ "https://github.com/jprichardson/tape-promise#readme" ], "dependencies": { - "@types/tape": "*" + "@types/tape": "^4.2.2" }, "devDependencies": { "@types/tape-promise": "workspace:." diff --git a/types/tape/.eslintrc.json b/types/tape/.eslintrc.json deleted file mode 100644 index 7d0b362cdfd161..00000000000000 --- a/types/tape/.eslintrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "rules": { - "@definitelytyped/strict-export-declare-modifiers": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-wrapper-object-types": "off" - } -} diff --git a/types/tape/.npmignore b/types/tape/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/tape/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/tape/index.d.ts b/types/tape/index.d.ts deleted file mode 100644 index ea0120fdec9059..00000000000000 --- a/types/tape/index.d.ts +++ /dev/null @@ -1,347 +0,0 @@ -/// - -import Through = require("@ljharb/through"); -import mockProperty = require("mock-property"); - -/** - * Create a new test with an optional name string and optional opts object. - * cb(t) fires with the new test object t once all preceding tests have finished. - * Tests execute serially. - */ -declare function tape(name: string, cb: tape.TestCase): void; -declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; -declare function tape(cb: tape.TestCase): void; -declare function tape(opts: tape.TestOptions, cb: tape.TestCase): void; - -declare namespace tape { - interface TestCase { - (test: Test): void | Promise; - } - - /** - * Available opts options for the tape function. - */ - interface TestOptions { - /** See test.skip. */ - skip?: boolean | string | undefined; - /** Set a timeout for the test, after which it will fail. See tape.timeoutAfter. */ - timeout?: number | undefined; - /** - * Configure max depth of expected/actual object printing. Environmental variable - * NODE_TAPE_OBJECT_PRINT_DEPTH can set the desired default depth for all tests; - * locally-set values will take precedence. - */ - objectPrintDepth?: number | undefined; - /** Test will be allowed to fail. */ - todo?: boolean | string | undefined; - } - - /** - * Available options for tape assertions. - */ - interface AssertOptions { - /** Skip the assertion. Can also be a message explaining why the test is skipped. */ - skip?: boolean | string | undefined; - /** Allows the assertion to fail. */ - todo?: boolean | string | undefined; - /** An optional description of the assertion. */ - message?: string | undefined; - } - - /** - * Options for the createStream function. - */ - interface StreamOptions { - objectMode?: boolean | undefined; - } - - /** - * Generate a new test that will be skipped over. - */ - export function skip(name: string, cb: tape.TestCase): void; - export function skip(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; - export function skip(cb: tape.TestCase): void; - export function skip(opts: tape.TestOptions, cb: tape.TestCase): void; - - /** - * The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary. - */ - export function onFinish(cb: () => void): void; - - /** - * The onFailure hook will get invoked whenever any tape tests have failed. - */ - export function onFailure(cb: () => void): void; - - /** - * Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. - */ - export function only(name: string, cb: tape.TestCase): void; - export function only(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; - export function only(cb: tape.TestCase): void; - export function only(opts: tape.TestOptions, cb: tape.TestCase): void; - - /** - * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state. - */ - export function createHarness(opts?: { autoclose?: boolean; noOnly?: boolean }): typeof tape; - - /** - * Create a memoized test harness instance, which is a function like test(), but with a new pending stack and test state. - */ - export function getHarness( - opts?: { - noOnly?: boolean; - exit?: boolean; - stream?: ReturnType; - } & StreamOptions, - ): typeof tape; - - /** - * Create a stream of output, bypassing the default output stream that writes messages to console.log(). - * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. - */ - export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream; - - type WithRequired = T & { [P in K]-?: T[P] }; - - export interface Test { - /** - * Create a subtest with a new test handle st from cb(st) inside the current test. - * cb(st) will only fire when t finishes. - * Additional tests queued up after t will not be run until all subtests finish. - */ - test(name: string, cb: tape.TestCase): void; - test(name: string, opts: TestOptions, cb: tape.TestCase): void; - test( - name: string, - opts: WithRequired | WithRequired, - cb?: tape.TestCase, - ): void; - - /** - * Declare that n assertions should be run. end() will be called automatically after the nth assertion. - * If there are any more assertions after the nth, or after end() is called, they will generate errors. - */ - plan(n: number): void; - - /** - * Declare the end of a test explicitly. - * If err is passed in t.end will assert that it is falsey. - */ - end(err?: any): void; - - /** - * Generate a failing assertion with a message msg. - */ - fail(msg?: string, extra?: AssertOptions): void; - - /** - * Generate a passing assertion with a message msg. - */ - pass(msg?: string, extra?: AssertOptions): void; - - /** - * Automatically timeout the test after X ms. - */ - timeoutAfter(ms: number): void; - - /** - * Generate an assertion that will be skipped over. - */ - skip(msg?: string, extra?: AssertOptions): void; - - /** - * Assert that value is truthy with an optional description message msg. - */ - ok(value: any, msg?: string, extra?: AssertOptions): void; - true: Test["ok"]; - assert: Test["ok"]; - - /** - * Assert that value is falsy with an optional description message msg. - */ - notOk(value: any, msg?: string, extra?: AssertOptions): void; - false: Test["notOk"]; - notok: Test["notOk"]; - - /** - * Assert that err is falsy. - * If err is non-falsy, use its err.message as the description message. - */ - error(err: any, msg?: string, extra?: AssertOptions): void; - ifError: Test["error"]; - ifErr: Test["error"]; - iferror: Test["error"]; - - /** - * Assert that a === b with an optional description msg. - */ - equal(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - equals: Test["equal"]; - isEqual: Test["equal"]; - is: Test["equal"]; - strictEqual: Test["equal"]; - strictEquals: Test["equal"]; - - /** - * Assert that a !== b with an optional description msg. - */ - notEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - notEquals: Test["notEqual"]; - notStrictEqual: Test["notEqual"]; - notStrictEquals: Test["notEqual"]; - isNotEqual: Test["notEqual"]; - isNot: Test["notEqual"]; - not: Test["notEqual"]; - doesNotEqual: Test["notEqual"]; - isInequal: Test["notEqual"]; - - /** - * Assert that actual == expected with an optional description of the assertion msg. - */ - looseEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - looseEquals: Test["looseEqual"]; - - /** - * Assert that actual != expected with an optional description of the assertion msg. - */ - notLooseEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - notLooseEquals: Test["looseEqual"]; - - /** - * Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg. - */ - deepEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - deepEquals: Test["deepEqual"]; - isEquivalent: Test["deepEqual"]; - same: Test["deepEqual"]; - - /** - * Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg. - */ - notDeepEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - notEquivalent: Test["notDeepEqual"]; - notDeeply: Test["notDeepEqual"]; - notSame: Test["notDeepEqual"]; - isNotDeepEqual: Test["notDeepEqual"]; - isNotDeeply: Test["notDeepEqual"]; - isNotEquivalent: Test["notDeepEqual"]; - isInequivalent: Test["notDeepEqual"]; - - /** - * Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg. - */ - deepLooseEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - - /** - * Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg. - */ - notDeepLooseEqual(actual: any, expected: any, msg?: string, extra?: AssertOptions): void; - - /** - * Assert that the function call fn() throws an exception. expected, if present, must be a RegExp, Function, or Object. - */ - throws(fn: () => void, msg?: string, extra?: AssertOptions): void; - throws(fn: () => void, exceptionExpected: object, msg?: string, extra?: AssertOptions): void; - - /** - * Assert that the function call fn() does not throw an exception. - */ - doesNotThrow(fn: () => void, msg?: string, extra?: AssertOptions): void; - // we actually do want any function-like value here, especially constructors - doesNotThrow(fn: () => void, exceptionExpected: RegExp | Function, msg?: string, extra?: AssertOptions): void; - - /** - * Print a message without breaking the tap output. - * (Useful when using e.g. tap-colorize where output is buffered & console.log will print in incorrect order vis-a-vis tap output.) - */ - comment(msg: string): void; - - /** - * Assert that string matches the RegExp regexp. Will throw (not just fail) when the first two arguments are the wrong type. - */ - match(actual: string, expected: RegExp, msg?: string, extra?: AssertOptions): void; - - /** - * Assert that string does not match the RegExp regexp. Will throw (not just fail) when the first two arguments are the wrong type. - */ - doesNotMatch(actual: string, expected: RegExp, msg?: string, extra?: AssertOptions): void; - - /** - * Register a callback to run after the individual test has completed. Multiple registered teardown callbacks will run in order. - */ - teardown(callback: () => void | Promise): void; - - captureFn(this: Test, original: X): WrappedFn; - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics - capture( - this: Test, - obj: Record | unknown[], - method: PropertyKey, - implementation?: T, - ): WrapResults; - intercept( - obj: Record | unknown[], - property: PropertyKey, - desc?: PropertyDescriptor, - ): InterceptResults; - - assertion( - this: Test, - fn: (this: Test, ...args: Args) => R, - ...args: Args - ): R; - } - - export type SyncCallback = (...args: unknown[]) => unknown; - export type SyncOrAsyncCallback = (...args: unknown[]) => unknown; - - export interface ReturnCall { - args: unknown[]; - receiver: {}; - returned: unknown; - } - - export interface ThrowCall { - args: unknown[]; - receiver: {}; - threw: true; - } - - export interface Call { - type: "get" | "set"; - success: boolean; - value: unknown; - args: unknown[]; - receiver: unknown; - } - - export type RestoreFunction = ReturnType; - - export interface WrapResults { - (): WrappedCall[]; - restore?: RestoreFunction; - } - - export interface WrappedFn { - (this: ThisParameterType, ...args: Parameters): ReturnType; - calls?: WrappedCall[]; - } - - export interface WrapObject { - __proto__: null; - wrapped: WrappedFn; - calls: WrappedCall[]; - results: WrapResults; - } - - export type WrappedCall = ReturnCall | ThrowCall; - - export interface InterceptResults { - (): Call[]; - restore: RestoreFunction; - } -} - -export = tape; diff --git a/types/tape/lib/default_stream.d.ts b/types/tape/lib/default_stream.d.ts deleted file mode 100644 index 3e359cdd9123d6..00000000000000 --- a/types/tape/lib/default_stream.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { ThroughStream } from "@ljharb/through"; - -declare function defaultStream(): ThroughStream; - -export = defaultStream; diff --git a/types/tape/lib/results.d.ts b/types/tape/lib/results.d.ts deleted file mode 100644 index b6c0df67545a38..00000000000000 --- a/types/tape/lib/results.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import through = require("@ljharb/through"); -import type { EventEmitter } from "events"; - -import type { StreamOptions } from "../"; -import Test = require("./test"); - -declare class Results extends EventEmitter { - constructor(options?: { todoIsOK?: boolean }); - - count: number; - fail: number; - pass: number; - tests: Array; - todo: number; - todoIsOK: boolean; - closed?: boolean; - - _isRunning: boolean; - _only: typeof Test | null; - _stream: through.ThroughStream; - - close(this: Results): void; - createStream(this: Results, opts?: StreamOptions): through.ThroughStream; - only(this: Results, t: typeof Test): void; - push(this: Results, t: typeof Test): void; - - _watch(this: Results, t: typeof Test): void; -} - -declare namespace Results { - export type Operator = string; - - export interface Result { - id: number; - ok: boolean; - skip: unknown; - todo: unknown; - name?: string; - operator: undefined | Operator; - objectPrintDepth?: number; - actual?: unknown; - expected?: unknown; - error?: unknown; - functionName?: string; - file?: string; - line?: number; - column?: number; - at?: string; - } -} - -export = Results; diff --git a/types/tape/lib/test.d.ts b/types/tape/lib/test.d.ts deleted file mode 100644 index 6024b1b1a1c344..00000000000000 --- a/types/tape/lib/test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { type Test } from "../"; - -declare const test: Test; - -export = test; diff --git a/types/tape/package.json b/types/tape/package.json deleted file mode 100644 index fa44d71af07972..00000000000000 --- a/types/tape/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "private": true, - "name": "@types/tape", - "version": "5.8.9999", - "exports": { - ".": "./index.d.ts", - "./lib/default_stream": "./lib/default_stream.d.ts", - "./lib/results": "./lib/results.d.ts", - "./lib/test": "./lib/test.d.ts", - "./package.json": "./package.json" - }, - "projects": [ - "https://github.com/ljharb/tape" - ], - "dependencies": { - "@types/node": "*", - "@ljharb/through": "*", - "mock-property": "*" - }, - "devDependencies": { - "@types/tape": "workspace:." - }, - "owners": [ - { - "name": "Bart van der Schoor", - "githubUsername": "Bartvds" - }, - { - "name": "Haoqun Jiang", - "githubUsername": "sodatea" - }, - { - "name": "Dennis Schwartz", - "githubUsername": "DennisSchwartz" - }, - { - "name": "Michael Henretty", - "githubUsername": "mikehenrty" - }, - { - "name": "RafaƂ Ostrowski", - "githubUsername": "rostrowski" - }, - { - "name": "Jordan Harband", - "githubUsername": "ljharb" - } - ] -} diff --git a/types/tape/tape-tests.ts b/types/tape/tape-tests.ts deleted file mode 100644 index 6f9958447e479d..00000000000000 --- a/types/tape/tape-tests.ts +++ /dev/null @@ -1,289 +0,0 @@ -import tape = require("tape"); - -import Test = require("tape/lib/test"); - -import { type RestoreFunction, type WrappedCall } from "tape"; - -var name: string; -var cb: tape.TestCase; -var topts: tape.TestOptions; -var t: tape.Test; - -tape(cb); -tape(name, cb); -tape(topts, cb); -tape(name, topts, cb); -tape(name, { skip: "skip message" }, cb); - -tape(name, (test: tape.Test) => { - t = test; -}); - -tape(name, async (test: tape.Test) => { - t = test; -}); - -tape.skip(cb); -tape.skip(name, cb); -tape.skip(topts, cb); -tape.skip(name, topts, cb); - -tape.only(cb); -tape.only(name, cb); -tape.only(topts, cb); -tape.only(name, topts, cb); - -tape.onFinish(() => {}); -tape.onFailure(() => {}); - -var sopts: tape.StreamOptions; -var rs: NodeJS.ReadableStream; -rs = tape.createStream(); -rs = tape.createStream(sopts); - -var htest: typeof tape; -htest = tape.createHarness(); - -class CustomException extends Error { - constructor(message?: string) { - super(message); - } -} - -tape(name, (test: tape.Test) => { - var num: number; - var ms: number; - var value: any; - var actual: any; - var expected: any; - var err: any; - var fn = function() {}; - var msg: string; - var extra: tape.AssertOptions; - var regex: RegExp; - - var exceptionExpected: RegExp | (() => void); - var throwsValidationObject: {}; - - test.plan(num); - test.end(); - test.end(err); - - test.fail(msg); - test.fail(msg, extra); - test.pass(msg); - test.pass(msg, extra); - test.timeoutAfter(ms); - test.skip(msg); - test.skip(msg, extra); - - test.ok(value); - test.ok(value, msg); - test.ok(value, msg, extra); - test.true(value); - test.true(value, msg); - test.true(value, msg, extra); - test.assert(value); - test.assert(value, msg); - test.assert(value, msg, extra); - - test.notOk(value); - test.notOk(value, msg); - test.notOk(value, msg, extra); - test.false(value); - test.false(value, msg); - test.false(value, msg, extra); - test.notok(value); - test.notok(value, msg); - test.notok(value, msg, extra); - - test.error(err, msg); - test.error(err, msg, extra); - test.ifError(err, msg); - test.ifError(err, msg, extra); - test.ifErr(err, msg); - test.ifErr(err, msg, extra); - test.iferror(err, msg); - test.iferror(err, msg, extra); - - test.equal(actual, expected); - test.equal(actual, expected, msg); - test.equal(actual, expected, msg, extra); - test.equals(actual, expected); - test.equals(actual, expected, msg); - test.equals(actual, expected, msg, extra); - test.isEqual(actual, expected); - test.isEqual(actual, expected, msg); - test.isEqual(actual, expected, msg, extra); - test.is(actual, expected); - test.is(actual, expected, msg); - test.is(actual, expected, msg, extra); - test.strictEqual(actual, expected); - test.strictEqual(actual, expected, msg); - test.strictEqual(actual, expected, msg, extra); - test.strictEquals(actual, expected); - test.strictEquals(actual, expected, msg); - test.strictEquals(actual, expected, msg, extra); - - test.notEqual(actual, expected); - test.notEqual(actual, expected, msg); - test.notEqual(actual, expected, msg, extra); - test.notEquals(actual, expected); - test.notEquals(actual, expected, msg); - test.notEquals(actual, expected, msg, extra); - test.notStrictEqual(actual, expected); - test.notStrictEqual(actual, expected, msg); - test.notStrictEqual(actual, expected, msg, extra); - test.notStrictEquals(actual, expected); - test.notStrictEquals(actual, expected, msg); - test.notStrictEquals(actual, expected, msg, extra); - test.isNotEqual(actual, expected); - test.isNotEqual(actual, expected, msg); - test.isNotEqual(actual, expected, msg, extra); - test.isNot(actual, expected); - test.isNot(actual, expected, msg); - test.isNot(actual, expected, msg, extra); - test.not(actual, expected); - test.not(actual, expected, msg); - test.not(actual, expected, msg, extra); - test.doesNotEqual(actual, expected); - test.doesNotEqual(actual, expected, msg); - test.doesNotEqual(actual, expected, msg, extra); - test.isInequal(actual, expected); - test.isInequal(actual, expected, msg); - test.isInequal(actual, expected, msg, extra); - - test.deepEqual(actual, expected); - test.deepEqual(actual, expected, msg); - test.deepEqual(actual, expected, msg, extra); - test.deepEquals(actual, expected); - test.deepEquals(actual, expected, msg); - test.deepEquals(actual, expected, msg, extra); - test.isEquivalent(actual, expected); - test.isEquivalent(actual, expected, msg); - test.isEquivalent(actual, expected, msg, extra); - test.same(actual, expected); - test.same(actual, expected, msg); - test.same(actual, expected, msg, extra); - - test.notDeepEqual(actual, expected); - test.notDeepEqual(actual, expected, msg); - test.notDeepEqual(actual, expected, msg, extra); - test.notEquivalent(actual, expected); - test.notEquivalent(actual, expected, msg); - test.notEquivalent(actual, expected, msg, extra); - test.notDeeply(actual, expected); - test.notDeeply(actual, expected, msg); - test.notDeeply(actual, expected, msg, extra); - test.notSame(actual, expected); - test.notSame(actual, expected, msg); - test.notSame(actual, expected, msg, extra); - test.isNotDeepEqual(actual, expected); - test.isNotDeepEqual(actual, expected, msg); - test.isNotDeepEqual(actual, expected, msg, extra); - test.isNotDeeply(actual, expected); - test.isNotDeeply(actual, expected, msg); - test.isNotDeeply(actual, expected, msg, extra); - test.isNotEquivalent(actual, expected); - test.isNotEquivalent(actual, expected, msg); - test.isNotEquivalent(actual, expected, msg, extra); - test.isInequivalent(actual, expected); - test.isInequivalent(actual, expected, msg); - test.isInequivalent(actual, expected, msg, extra); - - test.deepLooseEqual(actual, expected); - test.deepLooseEqual(actual, expected, msg); - test.deepLooseEqual(actual, expected, msg, extra); - test.looseEqual(actual, expected); - test.looseEqual(actual, expected, msg); - test.looseEqual(actual, expected, msg, extra); - test.looseEquals(actual, expected); - test.looseEquals(actual, expected, msg); - test.looseEquals(actual, expected, msg, extra); - - test.notDeepLooseEqual(actual, expected); - test.notDeepLooseEqual(actual, expected, msg); - test.notDeepLooseEqual(actual, expected, msg, extra); - test.notLooseEqual(actual, expected); - test.notLooseEqual(actual, expected, msg); - test.notLooseEqual(actual, expected, msg, extra); - test.notLooseEquals(actual, expected); - test.notLooseEquals(actual, expected, msg); - test.notLooseEquals(actual, expected, msg, extra); - - test.throws(fn); - test.throws(fn, msg); - test.throws(fn, msg, extra); - test.throws(fn, exceptionExpected); - test.throws(fn, exceptionExpected, msg); - test.throws(fn, exceptionExpected, msg, extra); - test.throws(fn, throwsValidationObject); - test.throws(fn, throwsValidationObject, msg); - test.throws(fn, throwsValidationObject, msg, extra); - test.throws(fn, CustomException); - test.throws(fn, CustomException, msg); - test.throws(fn, CustomException, msg, extra); - - test.doesNotThrow(fn); - test.doesNotThrow(fn, msg); - test.doesNotThrow(fn, msg, extra); - test.doesNotThrow(fn, exceptionExpected); - test.doesNotThrow(fn, exceptionExpected, msg); - test.doesNotThrow(fn, exceptionExpected, msg, extra); - test.doesNotThrow(fn, CustomException); - test.doesNotThrow(fn, CustomException, msg); - test.doesNotThrow(fn, CustomException, msg, extra); - - test.test(name, { todo: "to do" }); - test.test(name, { skip: "skip" }); - - test.test(name, { todo: "to do" }, (t) => { - t.end(); - }); - test.test(name, { skip: "skip" }, (t) => { - t.end(); - }); - - test.test(name, st => { - t = st; - }); - - test.test(name, async st => { - t = st; - }); - - test.test(name, topts, st => { - t = st; - }); - - test.test(name, topts, async st => { - t = st; - }); - - test.comment(msg); - - test.match(actual, regex); - test.match(actual, regex, msg); - test.match(actual, regex, msg, extra); - - test.doesNotMatch(actual, regex); - test.doesNotMatch(actual, regex, msg); - test.doesNotMatch(actual, regex, msg, extra); - - test.teardown(() => {}); - test.teardown(async () => {}); - - const captureFnResults = test.captureFn(() => 42); - captureFnResults(); // $ExpectType number - captureFnResults.calls; // $ExpectType WrappedCall[] - - const a: unknown[] = []; - const captureResults = test.capture(a, "push", () => "foo"); - captureResults(); // $ExpectType WrappedCall[] - captureResults.restore; // $ExpectType RestoreFunction - - function isFortyTwo(this: tape.Test, actual: unknown, message?: string) { - this.equal(actual, 42, message ?? "expected " + actual); - } - t.assertion(isFortyTwo, "not 42", "a message!"); // $ExpectType void -}); diff --git a/types/tape/tsconfig.json b/types/tape/tsconfig.json deleted file mode 100644 index 078b933ec0e116..00000000000000 --- a/types/tape/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "lib/default_stream.d.ts", - "lib/test.d.ts", - "lib/results.d.ts", - "tape-tests.ts" - ] -} diff --git a/types/typedarray-pool/package.json b/types/typedarray-pool/package.json index a25bccb515d342..2a259b40b95a94 100644 --- a/types/typedarray-pool/package.json +++ b/types/typedarray-pool/package.json @@ -6,7 +6,7 @@ "https://github.com/mikolalysenko/typedarray-pool" ], "devDependencies": { - "@types/tape": "*", + "@types/tape": "^4.0.0", "@types/typedarray-pool": "workspace:." }, "owners": [