@tapjs/test
Advanced tools
Comparing version 1.4.4 to 2.0.0
{ | ||
"name": "@tapjs/test", | ||
"version": "1.4.4", | ||
"version": "2.0.0", | ||
"description": "the pluggable Test class for node-tap", | ||
@@ -91,19 +91,19 @@ "tshy": { | ||
"@isaacs/ts-node-temp-fork-for-pr-2009": "^10.9.5", | ||
"@tapjs/after": "1.1.22", | ||
"@tapjs/after-each": "1.1.22", | ||
"@tapjs/asserts": "1.2.0", | ||
"@tapjs/before": "1.1.22", | ||
"@tapjs/before-each": "1.1.22", | ||
"@tapjs/filter": "1.2.22", | ||
"@tapjs/fixture": "1.2.22", | ||
"@tapjs/intercept": "1.2.22", | ||
"@tapjs/mock": "1.3.4", | ||
"@tapjs/node-serialize": "1.3.4", | ||
"@tapjs/snapshot": "1.2.22", | ||
"@tapjs/spawn": "1.1.22", | ||
"@tapjs/stdin": "1.1.22", | ||
"@tapjs/typescript": "1.4.4", | ||
"@tapjs/worker": "1.1.22", | ||
"glob": "^10.3.10", | ||
"jackspeak": "^2.3.6", | ||
"@tapjs/after": "1.1.23", | ||
"@tapjs/after-each": "2.0.0", | ||
"@tapjs/asserts": "2.0.0", | ||
"@tapjs/before": "2.0.0", | ||
"@tapjs/before-each": "2.0.0", | ||
"@tapjs/filter": "2.0.0", | ||
"@tapjs/fixture": "2.0.0", | ||
"@tapjs/intercept": "2.0.0", | ||
"@tapjs/mock": "2.0.0", | ||
"@tapjs/node-serialize": "2.0.0", | ||
"@tapjs/snapshot": "2.0.0", | ||
"@tapjs/spawn": "2.0.0", | ||
"@tapjs/stdin": "2.0.0", | ||
"@tapjs/typescript": "1.4.5", | ||
"@tapjs/worker": "2.0.0", | ||
"glob": "^10.3.16", | ||
"jackspeak": "^3.1.2", | ||
"mkdirp": "^3.0.0", | ||
@@ -113,8 +113,9 @@ "resolve-import": "^1.4.5", | ||
"sync-content": "^1.0.1", | ||
"tap-parser": "15.3.2", | ||
"tshy": "^1.12.0", | ||
"typescript": "5.2" | ||
"tap-parser": "16.0.0", | ||
"tshy": "^1.14.0", | ||
"typescript": "5.4", | ||
"walk-up-path": "^3.0.1" | ||
}, | ||
"peerDependencies": { | ||
"@tapjs/core": "1.5.4" | ||
"@tapjs/core": "2.0.0" | ||
}, | ||
@@ -121,0 +122,0 @@ "tap": { |
@@ -28,2 +28,3 @@ { | ||
"tshy": { | ||
"selfLink": false, | ||
"main": true, | ||
@@ -30,0 +31,0 @@ "exports": { |
@@ -47,7 +47,7 @@ //{{HEADER COMMENT START}} | ||
Ext extends BuiltPlugins, | ||
Opts extends TestOpts | ||
Opts extends TestOpts, | ||
>( | ||
t: Test<Ext, Opts>, | ||
plug: Plug<Opts>, | ||
v: Function | ||
v: Function, | ||
) => { | ||
@@ -69,3 +69,3 @@ const f: (this: Plug<Opts>, ...args: any) => any = function ( | ||
copyToString(v), | ||
copyInspect(v) | ||
copyInspect(v), | ||
) | ||
@@ -86,8 +86,11 @@ vv.prototype = v.prototype | ||
export type PluginResult< | ||
P extends ((t: TestBase, opts: any) => any)[] | ||
> = P extends [ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] | ||
? ReturnType<H> & PluginResult<T> | ||
P extends ((t: TestBase, opts: any) => any)[], | ||
> = | ||
P extends ( | ||
[ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[], | ||
] | ||
) ? | ||
ReturnType<H> & PluginResult<T> | ||
: {} | ||
@@ -98,7 +101,10 @@ | ||
*/ | ||
type AnyReturnValue<A extends ((...a: any[]) => any)[]> = A extends [ | ||
infer H extends (...a: any[]) => any, | ||
...infer T extends ((...a: any[]) => any)[] | ||
] | ||
? ReturnType<H> | AnyReturnValue<T> | ||
type AnyReturnValue<A extends ((...a: any[]) => any)[]> = | ||
A extends ( | ||
[ | ||
infer H extends (...a: any[]) => any, | ||
...infer T extends ((...a: any[]) => any)[], | ||
] | ||
) ? | ||
ReturnType<H> | AnyReturnValue<T> | ||
: never | ||
@@ -111,3 +117,3 @@ | ||
pluginLoaded<T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
): boolean | ||
@@ -126,8 +132,4 @@ plugins: TapPlugin<any, Opt>[] | ||
*/ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
infer S | ||
] | ||
? S | ||
: unknown | ||
export type SecondParam<T extends [any] | [any, any]> = | ||
T extends [any, infer S] ? S : unknown | ||
@@ -138,8 +140,11 @@ /** | ||
export type PluginOpts< | ||
P extends ((t: TestBase, opts: any) => any)[] | ||
> = P extends [ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] | ||
? SecondParam<Parameters<H>> & PluginOpts<T> | ||
P extends ((t: TestBase, opts: any) => any)[], | ||
> = | ||
P extends ( | ||
[ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[], | ||
] | ||
) ? | ||
SecondParam<Parameters<H>> & PluginOpts<T> | ||
: {} | ||
@@ -219,3 +224,3 @@ | ||
Ext extends BuiltPlugins, | ||
Opts extends TestOpts | ||
Opts extends TestOpts, | ||
>( | ||
@@ -226,3 +231,3 @@ base: Test<Ext, Opts>, | ||
| TapPlugin<any, Opts> | ||
)[] | ||
)[], | ||
): Test<Ext, Opts> & Ext => { | ||
@@ -232,3 +237,3 @@ const ext: Plug<Opts>[] = plugs | ||
.map(p => | ||
(p as TapPlugin<Plug<Opts>, TestBaseOpts>)(base, base.options) | ||
(p as TapPlugin<Plug<Opts>, TestBaseOpts>)(base, base.options), | ||
) | ||
@@ -313,3 +318,3 @@ .concat(base) | ||
}, | ||
}) | ||
}), | ||
) | ||
@@ -324,3 +329,3 @@ | ||
return <T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
) => { | ||
@@ -359,3 +364,3 @@ return plugs.includes(plugin) | ||
E extends BuiltPlugins = BuiltPlugins, | ||
O extends TestOpts = TestOpts | ||
O extends TestOpts = TestOpts, | ||
> = { | ||
@@ -371,3 +376,3 @@ [kPluginSet]: TapPlugin<any, O>[] | ||
Ext extends BuiltPlugins = BuiltPlugins, | ||
Opts extends TestOpts = TestOpts | ||
Opts extends TestOpts = TestOpts, | ||
> extends TTest { | ||
@@ -401,3 +406,3 @@ /** | ||
Ext extends BuiltPlugins = BuiltPlugins, | ||
Opts extends TestOpts = TestOpts | ||
Opts extends TestOpts = TestOpts, | ||
> | ||
@@ -423,3 +428,3 @@ extends TestBase | ||
[kClass]: Test, | ||
} | ||
}, | ||
) { | ||
@@ -467,7 +472,7 @@ super(opts) | ||
applyPlugin<B extends Object, O extends unknown = unknown>( | ||
plugin: TapPlugin<B, O> | ||
plugin: TapPlugin<B, O>, | ||
): Test<Ext & B, Opts & O> & Ext & B { | ||
if (this.printedOutput) { | ||
throw new Error( | ||
'Plugins must be applied prior to any test output' | ||
'Plugins must be applied prior to any test output', | ||
) | ||
@@ -493,3 +498,3 @@ } | ||
[kClass]: TestExtended, | ||
} | ||
}, | ||
) { | ||
@@ -518,3 +523,3 @@ super(opts, __INTERNAL) | ||
pluginLoaded<T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
): this is TestBase & T { | ||
@@ -541,14 +546,14 @@ plugin | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -562,3 +567,3 @@ test( | ||
extra, | ||
this.test | ||
this.test, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -575,14 +580,14 @@ } | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -597,3 +602,3 @@ todo( | ||
extra, | ||
this.todo | ||
this.todo, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -610,14 +615,14 @@ } | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -632,5 +637,5 @@ skip( | ||
extra, | ||
this.skip | ||
this.skip, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
} | ||
} |
@@ -5,3 +5,2 @@ { | ||
"rootDir": "../src", | ||
"target": "es2022", | ||
"module": "nodenext", | ||
@@ -8,0 +7,0 @@ "moduleResolution": "nodenext" |
@@ -31,6 +31,6 @@ import { PromiseWithSubtest, TapPlugin, TestBase, TestBaseOpts } from '@tapjs/core'; | ||
*/ | ||
export type PluginResult<P extends ((t: TestBase, opts: any) => any)[]> = P extends [ | ||
export type PluginResult<P extends ((t: TestBase, opts: any) => any)[]> = P extends ([ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] ? ReturnType<H> & PluginResult<T> : {}; | ||
]) ? ReturnType<H> & PluginResult<T> : {}; | ||
/** | ||
@@ -40,13 +40,10 @@ * Utility type to get the second parameter of a function, used to | ||
*/ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
infer S | ||
] ? S : unknown; | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [any, infer S] ? S : unknown; | ||
/** | ||
* The union of the second parameters of all loaded plugin methods | ||
*/ | ||
export type PluginOpts<P extends ((t: TestBase, opts: any) => any)[]> = P extends [ | ||
export type PluginOpts<P extends ((t: TestBase, opts: any) => any)[]> = P extends ([ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] ? SecondParam<Parameters<H>> & PluginOpts<T> : {}; | ||
]) ? SecondParam<Parameters<H>> & PluginOpts<T> : {}; | ||
/** | ||
@@ -96,3 +93,4 @@ * Options that may be provided to `t.test()`. Extends | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -116,3 +114,4 @@ multiple?: false | undefined; | ||
hint?: string | undefined; | ||
validate?: ((v: any) => v is string[]) | undefined; | ||
validate?: ((v: unknown) => v is string[]) | undefined; | ||
validOptions?: readonly string[] | undefined; | ||
} & { | ||
@@ -133,3 +132,4 @@ multiple: true; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -150,3 +150,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -166,3 +167,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -182,3 +184,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -199,3 +202,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -216,3 +220,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -233,3 +238,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -249,3 +255,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -265,3 +272,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -281,3 +289,4 @@ multiple?: false | undefined; | ||
hint?: string | undefined; | ||
validate?: ((v: any) => v is string) | undefined; | ||
validate?: ((v: unknown) => v is string) | undefined; | ||
validOptions?: readonly string[] | undefined; | ||
} & { | ||
@@ -284,0 +293,0 @@ multiple?: false | undefined; |
@@ -31,6 +31,6 @@ import { PromiseWithSubtest, TapPlugin, TestBase, TestBaseOpts } from '@tapjs/core'; | ||
*/ | ||
export type PluginResult<P extends ((t: TestBase, opts: any) => any)[]> = P extends [ | ||
export type PluginResult<P extends ((t: TestBase, opts: any) => any)[]> = P extends ([ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] ? ReturnType<H> & PluginResult<T> : {}; | ||
]) ? ReturnType<H> & PluginResult<T> : {}; | ||
/** | ||
@@ -40,13 +40,10 @@ * Utility type to get the second parameter of a function, used to | ||
*/ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
infer S | ||
] ? S : unknown; | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [any, infer S] ? S : unknown; | ||
/** | ||
* The union of the second parameters of all loaded plugin methods | ||
*/ | ||
export type PluginOpts<P extends ((t: TestBase, opts: any) => any)[]> = P extends [ | ||
export type PluginOpts<P extends ((t: TestBase, opts: any) => any)[]> = P extends ([ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] ? SecondParam<Parameters<H>> & PluginOpts<T> : {}; | ||
]) ? SecondParam<Parameters<H>> & PluginOpts<T> : {}; | ||
/** | ||
@@ -96,3 +93,4 @@ * Options that may be provided to `t.test()`. Extends | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -116,3 +114,4 @@ multiple?: false | undefined; | ||
hint?: string | undefined; | ||
validate?: ((v: any) => v is string[]) | undefined; | ||
validate?: ((v: unknown) => v is string[]) | undefined; | ||
validOptions?: readonly string[] | undefined; | ||
} & { | ||
@@ -133,3 +132,4 @@ multiple: true; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -150,3 +150,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -166,3 +167,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -182,3 +184,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -199,3 +202,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -216,3 +220,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -233,3 +238,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -249,3 +255,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -265,3 +272,4 @@ multiple?: false | undefined; | ||
hint?: undefined; | ||
validate?: ((v: any) => v is boolean) | undefined; | ||
validate?: ((v: unknown) => v is boolean) | undefined; | ||
validOptions?: undefined; | ||
} & { | ||
@@ -281,3 +289,4 @@ multiple?: false | undefined; | ||
hint?: string | undefined; | ||
validate?: ((v: any) => v is string) | undefined; | ||
validate?: ((v: unknown) => v is string) | undefined; | ||
validOptions?: readonly string[] | undefined; | ||
} & { | ||
@@ -284,0 +293,0 @@ multiple?: false | undefined; |
@@ -30,2 +30,3 @@ { | ||
"tshy": { | ||
"selfLink": false, | ||
"main": true, | ||
@@ -32,0 +33,0 @@ "exports": { |
@@ -65,7 +65,7 @@ //{{HEADER COMMENT START}} | ||
Ext extends BuiltPlugins, | ||
Opts extends TestOpts | ||
Opts extends TestOpts, | ||
>( | ||
t: Test<Ext, Opts>, | ||
plug: Plug<Opts>, | ||
v: Function | ||
v: Function, | ||
) => { | ||
@@ -87,3 +87,3 @@ const f: (this: Plug<Opts>, ...args: any) => any = function ( | ||
copyToString(v), | ||
copyInspect(v) | ||
copyInspect(v), | ||
) | ||
@@ -104,8 +104,11 @@ vv.prototype = v.prototype | ||
export type PluginResult< | ||
P extends ((t: TestBase, opts: any) => any)[] | ||
> = P extends [ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] | ||
? ReturnType<H> & PluginResult<T> | ||
P extends ((t: TestBase, opts: any) => any)[], | ||
> = | ||
P extends ( | ||
[ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[], | ||
] | ||
) ? | ||
ReturnType<H> & PluginResult<T> | ||
: {} | ||
@@ -116,7 +119,10 @@ | ||
*/ | ||
type AnyReturnValue<A extends ((...a: any[]) => any)[]> = A extends [ | ||
infer H extends (...a: any[]) => any, | ||
...infer T extends ((...a: any[]) => any)[] | ||
] | ||
? ReturnType<H> | AnyReturnValue<T> | ||
type AnyReturnValue<A extends ((...a: any[]) => any)[]> = | ||
A extends ( | ||
[ | ||
infer H extends (...a: any[]) => any, | ||
...infer T extends ((...a: any[]) => any)[], | ||
] | ||
) ? | ||
ReturnType<H> | AnyReturnValue<T> | ||
: never | ||
@@ -129,3 +135,3 @@ | ||
pluginLoaded<T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
): boolean | ||
@@ -144,8 +150,4 @@ plugins: TapPlugin<any, Opt>[] | ||
*/ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
infer S | ||
] | ||
? S | ||
: unknown | ||
export type SecondParam<T extends [any] | [any, any]> = | ||
T extends [any, infer S] ? S : unknown | ||
@@ -156,8 +158,11 @@ /** | ||
export type PluginOpts< | ||
P extends ((t: TestBase, opts: any) => any)[] | ||
> = P extends [ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[] | ||
] | ||
? SecondParam<Parameters<H>> & PluginOpts<T> | ||
P extends ((t: TestBase, opts: any) => any)[], | ||
> = | ||
P extends ( | ||
[ | ||
infer H extends (t: TestBase, opts: any) => any, | ||
...infer T extends ((t: TestBase, opts: any) => any)[], | ||
] | ||
) ? | ||
SecondParam<Parameters<H>> & PluginOpts<T> | ||
: {} | ||
@@ -419,3 +424,3 @@ | ||
Ext extends BuiltPlugins, | ||
Opts extends TestOpts | ||
Opts extends TestOpts, | ||
>( | ||
@@ -426,3 +431,3 @@ base: Test<Ext, Opts>, | ||
| TapPlugin<any, Opts> | ||
)[] | ||
)[], | ||
): Test<Ext, Opts> & Ext => { | ||
@@ -432,3 +437,3 @@ const ext: Plug<Opts>[] = plugs | ||
.map(p => | ||
(p as TapPlugin<Plug<Opts>, TestBaseOpts>)(base, base.options) | ||
(p as TapPlugin<Plug<Opts>, TestBaseOpts>)(base, base.options), | ||
) | ||
@@ -513,3 +518,3 @@ .concat(base) | ||
}, | ||
}) | ||
}), | ||
) | ||
@@ -524,3 +529,3 @@ | ||
return <T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
) => { | ||
@@ -559,3 +564,3 @@ return plugs.includes(plugin) | ||
E extends BuiltPlugins = BuiltPlugins, | ||
O extends TestOpts = TestOpts | ||
O extends TestOpts = TestOpts, | ||
> = { | ||
@@ -571,3 +576,3 @@ [kPluginSet]: TapPlugin<any, O>[] | ||
Ext extends BuiltPlugins = BuiltPlugins, | ||
Opts extends TestOpts = TestOpts | ||
Opts extends TestOpts = TestOpts, | ||
> extends TTest { | ||
@@ -601,3 +606,3 @@ /** | ||
Ext extends BuiltPlugins = BuiltPlugins, | ||
Opts extends TestOpts = TestOpts | ||
Opts extends TestOpts = TestOpts, | ||
> | ||
@@ -623,3 +628,3 @@ extends TestBase | ||
[kClass]: Test, | ||
} | ||
}, | ||
) { | ||
@@ -667,7 +672,7 @@ super(opts) | ||
applyPlugin<B extends Object, O extends unknown = unknown>( | ||
plugin: TapPlugin<B, O> | ||
plugin: TapPlugin<B, O>, | ||
): Test<Ext & B, Opts & O> & Ext & B { | ||
if (this.printedOutput) { | ||
throw new Error( | ||
'Plugins must be applied prior to any test output' | ||
'Plugins must be applied prior to any test output', | ||
) | ||
@@ -693,3 +698,3 @@ } | ||
[kClass]: TestExtended, | ||
} | ||
}, | ||
) { | ||
@@ -718,3 +723,3 @@ super(opts, __INTERNAL) | ||
pluginLoaded<T extends any = any>( | ||
plugin: (t: any, opts?: any) => T | ||
plugin: (t: any, opts?: any) => T, | ||
): this is TestBase & T { | ||
@@ -741,14 +746,14 @@ plugin | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
test( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -762,3 +767,3 @@ test( | ||
extra, | ||
this.test | ||
this.test, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -775,14 +780,14 @@ } | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
todo( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -797,3 +802,3 @@ todo( | ||
extra, | ||
this.todo | ||
this.todo, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -810,14 +815,14 @@ } | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
name: string, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
extra: Opts, | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
skip( | ||
cb: (t: Test<Ext, Opts> & Ext) => any | ||
cb: (t: Test<Ext, Opts> & Ext) => any, | ||
): PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
@@ -832,5 +837,5 @@ skip( | ||
extra, | ||
this.skip | ||
this.skip, | ||
) as PromiseWithSubtest<Test<Ext, Opts> & Ext> | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240207
3450
27
+ Addedwalk-up-path@^3.0.1
+ Added@tapjs/after@1.1.23(transitive)
+ Added@tapjs/after-each@2.0.0(transitive)
+ Added@tapjs/asserts@2.0.0(transitive)
+ Added@tapjs/before@2.0.0(transitive)
+ Added@tapjs/before-each@2.0.0(transitive)
+ Added@tapjs/core@2.0.0(transitive)
+ Added@tapjs/error-serdes@2.0.0(transitive)
+ Added@tapjs/filter@2.0.0(transitive)
+ Added@tapjs/fixture@2.0.0(transitive)
+ Added@tapjs/intercept@2.0.0(transitive)
+ Added@tapjs/mock@2.0.0(transitive)
+ Added@tapjs/node-serialize@2.0.0(transitive)
+ Added@tapjs/snapshot@2.0.0(transitive)
+ Added@tapjs/spawn@2.0.0(transitive)
+ Added@tapjs/stack@2.0.0(transitive)
+ Added@tapjs/stdin@2.0.0(transitive)
+ Added@tapjs/typescript@1.4.5(transitive)
+ Added@tapjs/worker@2.0.0(transitive)
+ Addedtap-parser@16.0.0(transitive)
+ Addedtcompare@7.0.0(transitive)
+ Addedtypescript@5.4.5(transitive)
- Removed@tapjs/after@1.1.22(transitive)
- Removed@tapjs/after-each@1.1.22(transitive)
- Removed@tapjs/asserts@1.2.0(transitive)
- Removed@tapjs/before@1.1.22(transitive)
- Removed@tapjs/before-each@1.1.22(transitive)
- Removed@tapjs/core@1.5.4(transitive)
- Removed@tapjs/error-serdes@1.2.2(transitive)
- Removed@tapjs/filter@1.2.22(transitive)
- Removed@tapjs/fixture@1.2.22(transitive)
- Removed@tapjs/intercept@1.2.22(transitive)
- Removed@tapjs/mock@1.3.4(transitive)
- Removed@tapjs/node-serialize@1.3.4(transitive)
- Removed@tapjs/snapshot@1.2.22(transitive)
- Removed@tapjs/spawn@1.1.22(transitive)
- Removed@tapjs/stack@1.2.8(transitive)
- Removed@tapjs/stdin@1.1.22(transitive)
- Removed@tapjs/typescript@1.4.4(transitive)
- Removed@tapjs/worker@1.1.22(transitive)
- Removedjackspeak@2.3.6(transitive)
- Removedtap-parser@15.3.2(transitive)
- Removedtcompare@6.4.6(transitive)
- Removedtypescript@5.2.2(transitive)
Updated@tapjs/after@1.1.23
Updated@tapjs/after-each@2.0.0
Updated@tapjs/asserts@2.0.0
Updated@tapjs/before@2.0.0
Updated@tapjs/before-each@2.0.0
Updated@tapjs/filter@2.0.0
Updated@tapjs/fixture@2.0.0
Updated@tapjs/intercept@2.0.0
Updated@tapjs/mock@2.0.0
Updated@tapjs/node-serialize@2.0.0
Updated@tapjs/snapshot@2.0.0
Updated@tapjs/spawn@2.0.0
Updated@tapjs/stdin@2.0.0
Updated@tapjs/typescript@1.4.5
Updated@tapjs/worker@2.0.0
Updatedglob@^10.3.16
Updatedjackspeak@^3.1.2
Updatedtap-parser@16.0.0
Updatedtshy@^1.14.0
Updatedtypescript@5.4