Commit e18ae3f6 authored by Spark's avatar Spark
Browse files

node_modules remove

parent 8503f806
// Type definitions for istanbul-lib-report 3.0
// Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Zacharias Björngren <https://github.com/zache>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { CoverageMap, FileCoverage, CoverageSummary } from 'istanbul-lib-coverage';
/**
* returns a reporting context for the supplied options
*/
export function createContext(options?: Partial<ContextOptions>): Context;
/**
* returns the default watermarks that would be used when not
* overridden
*/
export function getDefaultWatermarks(): Watermarks;
export class ReportBase {
constructor(options?: Partial<ReportBaseOptions>);
execute(context: Context): void;
}
export interface ReportBaseOptions {
summarizer: Summarizers;
}
export type Summarizers = 'flat' | 'nested' | 'pkg' | 'defaultSummarizer';
export interface ContextOptions {
coverageMap: CoverageMap;
defaultSummarizer: Summarizers;
dir: string;
watermarks: Partial<Watermarks>;
sourceFinder(filepath: string): string;
}
export interface Context {
data: any;
dir: string;
sourceFinder(filepath: string): string;
watermarks: Watermarks;
writer: FileWriter;
/**
* returns the coverage class given a coverage
* types and a percentage value.
*/
classForPercent(type: keyof Watermarks, value: number): string;
/**
* returns the source code for the specified file path or throws if
* the source could not be found.
*/
getSource(filepath: string): string;
getTree(summarizer?: Summarizers): Tree;
/**
* returns a full visitor given a partial one.
*/
getVisitor<N extends Node = Node>(visitor: Partial<Visitor<N>>): Visitor<N>;
/**
* returns a FileWriter implementation for reporting use. Also available
* as the `writer` property on the context.
*/
getWriter(): FileWriter;
/**
* returns an XML writer for the supplied content writer
*/
getXmlWriter(contentWriter: ContentWriter): XmlWriter;
}
/**
* Base class for writing content
*/
export class ContentWriter {
/**
* returns the colorized version of a string. Typically,
* content writers that write to files will return the
* same string and ones writing to a tty will wrap it in
* appropriate escape sequences.
*/
colorize(str: string, clazz?: string): string;
/**
* writes a string appended with a newline to the destination
*/
println(str: string): void;
/**
* closes this content writer. Should be called after all writes are complete.
*/
close(): void;
}
/**
* a content writer that writes to a file
*/
export class FileContentWriter extends ContentWriter {
constructor(fileDescriptor: number);
write(str: string): void;
}
/**
* a content writer that writes to the console
*/
export class ConsoleWriter extends ContentWriter {
write(str: string): void;
}
/**
* utility for writing files under a specific directory
*/
export class FileWriter {
constructor(baseDir: string);
static startCapture(): void;
static stopCapture(): void;
static getOutput(): string;
static resetOutput(): void;
/**
* returns a FileWriter that is rooted at the supplied subdirectory
*/
writeForDir(subdir: string): FileWriter;
/**
* copies a file from a source directory to a destination name
*/
copyFile(source: string, dest: string, header?: string): void;
/**
* returns a content writer for writing content to the supplied file.
*/
writeFile(file: string | null): ContentWriter;
}
export interface XmlWriter {
indent(str: string): string;
/**
* writes the opening XML tag with the supplied attributes
*/
openTag(name: string, attrs?: any): void;
/**
* closes an open XML tag.
*/
closeTag(name: string): void;
/**
* writes a tag and its value opening and closing it at the same time
*/
inlineTag(name: string, attrs?: any, content?: string): void;
/**
* closes all open tags and ends the document
*/
closeAll(): void;
}
export type Watermark = [number, number];
export interface Watermarks {
statements: Watermark;
functions: Watermark;
branches: Watermark;
lines: Watermark;
}
export interface Node {
isRoot(): boolean;
visit(visitor: Visitor, state: any): void;
}
export interface ReportNode extends Node {
path: string;
parent: ReportNode | null;
fileCoverage: FileCoverage;
children: ReportNode[];
addChild(child: ReportNode): void;
asRelative(p: string): string;
getQualifiedName(): string;
getRelativeName(): string;
getParent(): Node;
getChildren(): Node[];
isSummary(): boolean;
getFileCoverage(): FileCoverage;
getCoverageSummary(filesOnly: boolean): CoverageSummary;
visit(visitor: Visitor<ReportNode>, state: any): void;
}
export interface Visitor<N extends Node = Node> {
onStart(root: N, state: any): void;
onSummary(root: N, state: any): void;
onDetail(root: N, state: any): void;
onSummaryEnd(root: N, state: any): void;
onEnd(root: N, state: any): void;
}
export interface Tree<N extends Node = Node> {
getRoot(): N;
visit(visitor: Partial<Visitor<N>>, state: any): void;
}
{
"name": "@types/istanbul-lib-report",
"version": "3.0.0",
"description": "TypeScript definitions for istanbul-lib-report",
"license": "MIT",
"contributors": [
{
"name": "Jason Cheatham",
"url": "https://github.com/jason0x43",
"githubUsername": "jason0x43"
},
{
"name": "Zacharias Björngren",
"url": "https://github.com/zache",
"githubUsername": "zache"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/istanbul-lib-report"
},
"scripts": {},
"dependencies": {
"@types/istanbul-lib-coverage": "*"
},
"typesPublisherContentHash": "f8b2f5e15a24d9f52a96c5cfadb0f582bf6200ce8643e15422c3c8f1a2bb1c63",
"typeScriptVersion": "2.8"
}
\ No newline at end of file
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
# Installation
> `npm install --save @types/istanbul-reports`
# Summary
This package contains type definitions for istanbul-reports (https://github.com/istanbuljs/istanbuljs).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports/index.d.ts)
````ts
// Type definitions for istanbul-reports 3.0
// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Elena Shcherbakova <https://github.com/not-a-doctor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { Node, ReportBase } from 'istanbul-lib-report';
export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): ReportBase;
export interface FileOptions {
file: string;
}
export interface ProjectOptions {
projectRoot: string;
}
export interface ReportOptions {
clover: CloverOptions;
cobertura: CoberturaOptions;
'html-spa': HtmlSpaOptions;
html: HtmlOptions;
json: JsonOptions;
'json-summary': JsonSummaryOptions;
lcov: LcovOptions;
lcovonly: LcovOnlyOptions;
none: never;
teamcity: TeamcityOptions;
text: TextOptions;
'text-lcov': TextLcovOptions;
'text-summary': TextSummaryOptions;
}
export type ReportType = keyof ReportOptions;
export interface CloverOptions extends FileOptions, ProjectOptions {}
export interface CoberturaOptions extends FileOptions, ProjectOptions {}
export interface HtmlSpaOptions extends HtmlOptions {
metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
}
export interface HtmlOptions {
verbose: boolean;
skipEmpty: boolean;
subdir: string;
linkMapper: LinkMapper;
}
export type JsonOptions = FileOptions;
export type JsonSummaryOptions = FileOptions;
export interface LcovOptions extends FileOptions, ProjectOptions {}
export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
export interface TeamcityOptions extends FileOptions {
blockName: string;
}
export interface TextOptions extends FileOptions {
maxCols: number;
skipEmpty: boolean;
skipFull: boolean;
}
export type TextLcovOptions = ProjectOptions;
export type TextSummaryOptions = FileOptions;
export interface LinkMapper {
getPath(node: string | Node): string;
relativePath(source: string | Node, target: string | Node): string;
assetPath(node: Node, name: string): string;
}
````
### Additional Details
* Last updated: Tue, 01 Jun 2021 21:02:19 GMT
* Dependencies: [@types/istanbul-lib-report](https://npmjs.com/package/@types/istanbul-lib-report)
* Global values: none
# Credits
These definitions were written by [Jason Cheatham](https://github.com/jason0x43), and [Elena Shcherbakova](https://github.com/not-a-doctor).
// Type definitions for istanbul-reports 3.0
// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Elena Shcherbakova <https://github.com/not-a-doctor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { Node, ReportBase } from 'istanbul-lib-report';
export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): ReportBase;
export interface FileOptions {
file: string;
}
export interface ProjectOptions {
projectRoot: string;
}
export interface ReportOptions {
clover: CloverOptions;
cobertura: CoberturaOptions;
'html-spa': HtmlSpaOptions;
html: HtmlOptions;
json: JsonOptions;
'json-summary': JsonSummaryOptions;
lcov: LcovOptions;
lcovonly: LcovOnlyOptions;
none: never;
teamcity: TeamcityOptions;
text: TextOptions;
'text-lcov': TextLcovOptions;
'text-summary': TextSummaryOptions;
}
export type ReportType = keyof ReportOptions;
export interface CloverOptions extends FileOptions, ProjectOptions {}
export interface CoberturaOptions extends FileOptions, ProjectOptions {}
export interface HtmlSpaOptions extends HtmlOptions {
metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
}
export interface HtmlOptions {
verbose: boolean;
skipEmpty: boolean;
subdir: string;
linkMapper: LinkMapper;
}
export type JsonOptions = FileOptions;
export type JsonSummaryOptions = FileOptions;
export interface LcovOptions extends FileOptions, ProjectOptions {}
export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
export interface TeamcityOptions extends FileOptions {
blockName: string;
}
export interface TextOptions extends FileOptions {
maxCols: number;
skipEmpty: boolean;
skipFull: boolean;
}
export type TextLcovOptions = ProjectOptions;
export type TextSummaryOptions = FileOptions;
export interface LinkMapper {
getPath(node: string | Node): string;
relativePath(source: string | Node, target: string | Node): string;
assetPath(node: Node, name: string): string;
}
{
"name": "@types/istanbul-reports",
"version": "3.0.1",
"description": "TypeScript definitions for istanbul-reports",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports",
"license": "MIT",
"contributors": [
{
"name": "Jason Cheatham",
"url": "https://github.com/jason0x43",
"githubUsername": "jason0x43"
},
{
"name": "Elena Shcherbakova",
"url": "https://github.com/not-a-doctor",
"githubUsername": "not-a-doctor"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/istanbul-reports"
},
"scripts": {},
"dependencies": {
"@types/istanbul-lib-report": "*"
},
"typesPublisherContentHash": "b331eb26db90bca3bd6f1e18a10a4f37631f149624847439756763800996e143",
"typeScriptVersion": "3.6"
}
\ No newline at end of file
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
# Installation
> `npm install --save @types/jest`
# Summary
This package contains type definitions for Jest (https://jestjs.io/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest.
### Additional Details
* Last updated: Mon, 26 Apr 2021 11:01:22 GMT
* Dependencies: [@types/jest-diff](https://npmjs.com/package/@types/jest-diff), [@types/pretty-format](https://npmjs.com/package/@types/pretty-format)
* Global values: `afterAll`, `afterEach`, `beforeAll`, `beforeEach`, `describe`, `expect`, `fail`, `fdescribe`, `fit`, `it`, `jasmine`, `jest`, `pending`, `spyOn`, `test`, `xdescribe`, `xit`, `xtest`
# Credits
These definitions were written by [Asana (https://asana.com)
// Ivo Stratev](https://github.com/NoHomey), [jwbay](https://github.com/jwbay), [Alexey Svetliakov](https://github.com/asvetliakov), [Alex Jover Morales](https://github.com/alexjoverm), [Allan Lukwago](https://github.com/epicallan), [Ika](https://github.com/ikatyang), [Waseem Dahman](https://github.com/wsmd), [Jamie Mason](https://github.com/JamieMason), [Douglas Duteil](https://github.com/douglasduteil), [Ahn](https://github.com/ahnpnl), [Josh Goldberg](https://github.com/joshuakgoldberg), [Jeff Lau](https://github.com/UselessPickles), [Andrew Makarov](https://github.com/r3nya), [Martin Hochel](https://github.com/hotell), [Sebastian Sebald](https://github.com/sebald), [Andy](https://github.com/andys8), [Antoine Brault](https://github.com/antoinebrault), [Gregor Stamać](https://github.com/gstamac), [ExE Boss](https://github.com/ExE-Boss), [Alex Bolenok](https://github.com/quassnoi), [Mario Beltrán Alarcón](https://github.com/Belco90), [Tony Hallett](https://github.com/tonyhallett), [Jason Yu](https://github.com/ycmjason), [Devansh Jethmalani](https://github.com/devanshj), [Pawel Fajfer](https://github.com/pawfa), [Regev Brody](https://github.com/regevbr), and [Alexandre Germain](https://github.com/gerkindev).
This diff is collapsed.
{
"name": "@types/jest",
"version": "26.0.23",
"description": "TypeScript definitions for Jest",
"license": "MIT",
"contributors": [
{
"name": "Asana (https://asana.com)\n// Ivo Stratev",
"url": "https://github.com/NoHomey",
"githubUsername": "NoHomey"
},
{
"name": "jwbay",
"url": "https://github.com/jwbay",
"githubUsername": "jwbay"
},
{
"name": "Alexey Svetliakov",
"url": "https://github.com/asvetliakov",
"githubUsername": "asvetliakov"
},
{
"name": "Alex Jover Morales",
"url": "https://github.com/alexjoverm",
"githubUsername": "alexjoverm"
},
{
"name": "Allan Lukwago",
"url": "https://github.com/epicallan",
"githubUsername": "epicallan"
},
{
"name": "Ika",
"url": "https://github.com/ikatyang",
"githubUsername": "ikatyang"
},
{
"name": "Waseem Dahman",
"url": "https://github.com/wsmd",
"githubUsername": "wsmd"
},
{
"name": "Jamie Mason",
"url": "https://github.com/JamieMason",
"githubUsername": "JamieMason"
},
{
"name": "Douglas Duteil",
"url": "https://github.com/douglasduteil",
"githubUsername": "douglasduteil"
},
{
"name": "Ahn",
"url": "https://github.com/ahnpnl",
"githubUsername": "ahnpnl"
},
{
"name": "Josh Goldberg",
"url": "https://github.com/joshuakgoldberg",
"githubUsername": "joshuakgoldberg"
},
{
"name": "Jeff Lau",
"url": "https://github.com/UselessPickles",
"githubUsername": "UselessPickles"
},
{
"name": "Andrew Makarov",
"url": "https://github.com/r3nya",
"githubUsername": "r3nya"
},
{
"name": "Martin Hochel",
"url": "https://github.com/hotell",
"githubUsername": "hotell"
},
{
"name": "Sebastian Sebald",
"url": "https://github.com/sebald",
"githubUsername": "sebald"
},
{
"name": "Andy",
"url": "https://github.com/andys8",
"githubUsername": "andys8"
},
{
"name": "Antoine Brault",
"url": "https://github.com/antoinebrault",
"githubUsername": "antoinebrault"
},
{
"name": "Gregor Stamać",
"url": "https://github.com/gstamac",
"githubUsername": "gstamac"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
},
{
"name": "Alex Bolenok",
"url": "https://github.com/quassnoi",
"githubUsername": "quassnoi"
},
{
"name": "Mario Beltrán Alarcón",
"url": "https://github.com/Belco90",
"githubUsername": "Belco90"
},
{
"name": "Tony Hallett",
"url": "https://github.com/tonyhallett",
"githubUsername": "tonyhallett"
},
{
"name": "Jason Yu",
"url": "https://github.com/ycmjason",
"githubUsername": "ycmjason"
},
{
"name": "Devansh Jethmalani",
"url": "https://github.com/devanshj",
"githubUsername": "devanshj"
},
{
"name": "Pawel Fajfer",
"url": "https://github.com/pawfa",
"githubUsername": "pawfa"
},
{
"name": "Regev Brody",
"url": "https://github.com/regevbr",
"githubUsername": "regevbr"
},
{
"name": "Alexandre Germain",
"url": "https://github.com/gerkindev",
"githubUsername": "gerkindev"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/jest"
},
"scripts": {},
"dependencies": {
"jest-diff": "^26.0.0",
"pretty-format": "^26.0.0"
},
"typesPublisherContentHash": "2ba294369468924cf573f064d944f4d4df1a25e8b23a828c75a085ef2452f0c3",
"typeScriptVersion": "3.8"
}
\ No newline at end of file
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
# Installation
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (http://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Sun, 27 Jun 2021 03:01:14 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys).
declare module 'assert' {
/** An alias of `assert.ok()`. */
function assert(value: any, message?: string | Error): asserts value;
namespace assert {
class AssertionError extends Error {
actual: any;
expected: any;
operator: string;
generatedMessage: boolean;
code: 'ERR_ASSERTION';
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string;
/** The `actual` property on the error instance. */
actual?: any;
/** The `expected` property on the error instance. */
expected?: any;
/** The `operator` property on the error instance. */
operator?: string;
/** If provided, the generated stack trace omits frames before this function. */
// tslint:disable-next-line:ban-types
stackStartFn?: Function;
});
}
class CallTracker {
calls(exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
report(): CallTrackerReportInformation[];
verify(): void;
}
interface CallTrackerReportInformation {
message: string;
/** The actual number of times the function was called. */
actual: number;
/** The number of times the function was expected to be called. */
expected: number;
/** The name of the function that is wrapped. */
operator: string;
/** A stack trace of the function. */
stack: object;
}
type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
function fail(message?: string | Error): never;
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
function fail(
actual: any,
expected: any,
message?: string | Error,
operator?: string,
// tslint:disable-next-line:ban-types
stackStartFn?: Function,
): never;
function ok(value: any, message?: string | Error): asserts value;
/** @deprecated since v9.9.0 - use strictEqual() instead. */
function equal(actual: any, expected: any, message?: string | Error): void;
/** @deprecated since v9.9.0 - use notStrictEqual() instead. */
function notEqual(actual: any, expected: any, message?: string | Error): void;
/** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
function deepEqual(actual: any, expected: any, message?: string | Error): void;
/** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
function throws(block: () => any, message?: string | Error): void;
function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
function doesNotThrow(block: () => any, message?: string | Error): void;
function doesNotThrow(block: () => any, error: AssertPredicate, message?: string | Error): void;
function ifError(value: any): asserts value is null | undefined;
function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
function rejects(
block: (() => Promise<any>) | Promise<any>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
function doesNotReject(
block: (() => Promise<any>) | Promise<any>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
function match(value: string, regExp: RegExp, message?: string | Error): void;
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
const strict: Omit<
typeof assert,
| 'equal'
| 'notEqual'
| 'deepEqual'
| 'notDeepEqual'
| 'ok'
| 'strictEqual'
| 'deepStrictEqual'
| 'ifError'
| 'strict'
> & {
(value: any, message?: string | Error): asserts value;
equal: typeof strictEqual;
notEqual: typeof notStrictEqual;
deepEqual: typeof deepStrictEqual;
notDeepEqual: typeof notDeepStrictEqual;
// Mapped types and assertion functions are incompatible?
// TS2775: Assertions require every name in the call target
// to be declared with an explicit type annotation.
ok: typeof ok;
strictEqual: typeof strictEqual;
deepStrictEqual: typeof deepStrictEqual;
ifError: typeof ifError;
strict: typeof strict;
};
}
export = assert;
}
declare module 'assert/strict' {
import { strict } from 'assert';
export = strict;
}
/**
* Async Hooks module: https://nodejs.org/api/async_hooks.html
*/
declare module 'async_hooks' {
/**
* Returns the asyncId of the current execution context.
*/
function executionAsyncId(): number;
/**
* The resource representing the current execution.
* Useful to store data within the resource.
*
* Resource objects returned by `executionAsyncResource()` are most often internal
* Node.js handle objects with undocumented APIs. Using any functions or properties
* on the object is likely to crash your application and should be avoided.
*
* Using `executionAsyncResource()` in the top-level execution context will
* return an empty object as there is no handle or request object to use,
* but having an object representing the top-level can be helpful.
*/
function executionAsyncResource(): object;
/**
* Returns the ID of the resource responsible for calling the callback that is currently being executed.
*/
function triggerAsyncId(): number;
interface HookCallbacks {
/**
* Called when a class is constructed that has the possibility to emit an asynchronous event.
* @param asyncId a unique ID for the async resource
* @param type the type of the async resource
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
* @param resource reference to the resource representing the async operation, needs to be released during destroy
*/
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
/**
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
* The before callback is called just before said callback is executed.
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
*/
before?(asyncId: number): void;
/**
* Called immediately after the callback specified in before is completed.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
*/
after?(asyncId: number): void;
/**
* Called when a promise has resolve() called. This may not be in the same execution id
* as the promise itself.
* @param asyncId the unique id for the promise that was resolve()d.
*/
promiseResolve?(asyncId: number): void;
/**
* Called after the resource corresponding to asyncId is destroyed
* @param asyncId a unique ID for the async resource
*/
destroy?(asyncId: number): void;
}
interface AsyncHook {
/**
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
*/
enable(): this;
/**
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
*/
disable(): this;
}
/**
* Registers functions to be called for different lifetime events of each async operation.
* @param options the callbacks to register
* @return an AsyncHooks instance used for disabling and enabling hooks
*/
function createHook(options: HookCallbacks): AsyncHook;
interface AsyncResourceOptions {
/**
* The ID of the execution context that created this async event.
* @default executionAsyncId()
*/
triggerAsyncId?: number;
/**
* Disables automatic `emitDestroy` when the object is garbage collected.
* This usually does not need to be set (even if `emitDestroy` is called
* manually), unless the resource's `asyncId` is retrieved and the
* sensitive API's `emitDestroy` is called with it.
* @default false
*/
requireManualDestroy?: boolean;
}
/**
* The class AsyncResource was designed to be extended by the embedder's async resources.
* Using this users can easily trigger the lifetime events of their own resources.
*/
class AsyncResource {
/**
* AsyncResource() is meant to be extended. Instantiating a
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* async_hook.executionAsyncId() is used.
* @param type The type of async event.
* @param triggerAsyncId The ID of the execution context that created
* this async event (default: `executionAsyncId()`), or an
* AsyncResourceOptions object (since 9.3)
*/
constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
/**
* Binds the given function to the current execution context.
* @param fn The function to bind to the current execution context.
* @param type An optional name to associate with the underlying `AsyncResource`.
*/
static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
/**
* Binds the given function to execute to this `AsyncResource`'s scope.
* @param fn The function to bind to the current `AsyncResource`.
*/
bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource };
/**
* Call the provided function with the provided arguments in the
* execution context of the async resource. This will establish the
* context, trigger the AsyncHooks before callbacks, call the function,
* trigger the AsyncHooks after callbacks, and then restore the original
* execution context.
* @param fn The function to call in the execution context of this
* async resource.
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
/**
* Call AsyncHooks destroy callbacks.
*/
emitDestroy(): this;
/**
* @return the unique ID assigned to this AsyncResource instance.
*/
asyncId(): number;
/**
* @return the trigger ID for this AsyncResource instance.
*/
triggerAsyncId(): number;
}
/**
* When having multiple instances of `AsyncLocalStorage`, they are independent
* from each other. It is safe to instantiate this class multiple times.
*/
class AsyncLocalStorage<T> {
/**
* This method disables the instance of `AsyncLocalStorage`. All subsequent calls
* to `asyncLocalStorage.getStore()` will return `undefined` until
* `asyncLocalStorage.run()` is called again.
*
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
* instance will be exited.
*
* Calling `asyncLocalStorage.disable()` is required before the
* `asyncLocalStorage` can be garbage collected. This does not apply to stores
* provided by the `asyncLocalStorage`, as those objects are garbage collected
* along with the corresponding async resources.
*
* This method is to be used when the `asyncLocalStorage` is not in use anymore
* in the current process.
*/
disable(): void;
/**
* This method returns the current store. If this method is called outside of an
* asynchronous context initialized by calling `asyncLocalStorage.run`, it will
* return `undefined`.
*/
getStore(): T | undefined;
/**
* This methods runs a function synchronously within a context and return its
* return value. The store is not accessible outside of the callback function or
* the asynchronous operations created within the callback.
*
* Optionally, arguments can be passed to the function. They will be passed to the
* callback function.
*
* I the callback function throws an error, it will be thrown by `run` too. The
* stacktrace will not be impacted by this call and the context will be exited.
*/
// TODO: Apply generic vararg once available
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
/**
* This methods runs a function synchronously outside of a context and return its
* return value. The store is not accessible within the callback function or the
* asynchronous operations created within the callback.
*
* Optionally, arguments can be passed to the function. They will be passed to the
* callback function.
*
* If the callback function throws an error, it will be thrown by `exit` too. The
* stacktrace will not be impacted by this call and the context will be
* re-entered.
*/
// TODO: Apply generic vararg once available
exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
/**
* Calling `asyncLocalStorage.enterWith(store)` will transition into the context
* for the remainder of the current synchronous execution and will persist
* through any following asynchronous calls.
*/
enterWith(store: T): void;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment