@tapjs/test
Advanced tools
Comparing version 0.0.0-11 to 0.0.0-12
{ | ||
"name": "@tapjs/test", | ||
"version": "0.0.0-11", | ||
"version": "0.0.0-12", | ||
"description": "the pluggable Test class for node-tap", | ||
@@ -44,13 +44,13 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
"peerDependencies": { | ||
"@tapjs/core": "0.0.0-11" | ||
"@tapjs/core": "0.0.0-12" | ||
}, | ||
"dependencies": { | ||
"@tapjs/test-built": "file:./test-built", | ||
"glob": "^10.3.2", | ||
"glob": "^10.3.3", | ||
"jackspeak": "^2.2.3", | ||
"mkdirp": "^3.0.0", | ||
"sync-content": "^1.0.1", | ||
"tap-parser": "15.0.0-1", | ||
"tap-parser": "15.0.0-2", | ||
"ts-node": "github:TypeStrong/ts-node#8f6f4e5", | ||
"typescript": "^5.0.2" | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -57,0 +57,0 @@ "license": "BlueOak-1.0.0", |
@@ -62,9 +62,10 @@ //{{HEADER COMMENT START}} | ||
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> | ||
: {} | ||
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> | ||
: {} | ||
@@ -97,3 +98,3 @@ /** | ||
// options | ||
type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
@@ -118,5 +119,6 @@ infer S | ||
/** | ||
* Options that may be provided to `t.test()`. Extends {@link Extra}, | ||
* {@link BaseOpts}, {@link TestBaseOpts}, and the second | ||
* argument to all plugin methods currently in use. | ||
* Options that may be provided to `t.test()`. Extends | ||
* {@link @tapjs/core!index.Extra}, {@link @tapjs/core!base.BaseOpts}, | ||
* {@link @tapjs/core!test-base.TestBaseOpts}, and the second argument to all | ||
* plugin methods currently in use. | ||
*/ | ||
@@ -132,3 +134,6 @@ export type TestOpts = TestBaseOpts & PluginOpts<PluginSet> | ||
} | ||
type PluginSet = (TapPlugin<any> | TapPlugin<any, TestBaseOpts>)[] | ||
export type PluginSet = ( | ||
| TapPlugin<any> | ||
| TapPlugin<any, TestBaseOpts> | ||
)[] | ||
//{{PLUGINS CODE END}} | ||
@@ -154,5 +159,6 @@ | ||
/** | ||
* Union type of {@link TestBase} plus all plugin return values | ||
* Union type of {@link @tapjs/core!test-base.TestBase} plus all plugin return | ||
* values | ||
*/ | ||
type TTest<P extends PluginSet = PluginSet> = TestBase & | ||
export type TTest<P extends PluginSet = PluginSet> = TestBase & | ||
PluginResult<P> | ||
@@ -257,9 +263,7 @@ | ||
) | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: 'Test', | ||
}) | ||
// assign a reference to the extended Test for use in plugin at run-time | ||
Object.assign(base, { t }) | ||
// put the .t self-ref and plugin inspection on top of the stack | ||
ext.unshift({ | ||
const top = { | ||
t, | ||
@@ -276,3 +280,15 @@ get pluginLoaded() { | ||
}, | ||
} | ||
ext.unshift(top) | ||
//@ts-ignore | ||
const tst: string = base[Symbol.toStringTag] | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}) | ||
Object.defineProperty(top, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}) | ||
return t | ||
@@ -283,3 +299,3 @@ } | ||
const kClass = Symbol('@tapjs/test construction class') | ||
type PluginExtensionOption< | ||
export type PluginExtensionOption< | ||
E extends BuiltPlugins = BuiltPlugins, | ||
@@ -293,3 +309,3 @@ O extends TestOpts = TestOpts | ||
/** | ||
* interface defining the fully extended {@link Test} class. | ||
* interface defining the fully extended {@link @tapjs/test!index.Test} class. | ||
*/ | ||
@@ -305,6 +321,6 @@ export interface Test< | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -325,3 +341,3 @@ export class Test< | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -348,13 +364,8 @@ * @internal | ||
/* c8 ignore start */ | ||
get [Symbol.toStringTag]() { | ||
return 'Test' | ||
} | ||
/* c8 ignore stop */ | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -407,2 +418,6 @@ * Typically, it's best to load plugins using configuration, set via the | ||
extended.#Class = TestExtended | ||
Object.defineProperty(TestExtended, 'name', { | ||
value: 'Test', | ||
configurable: true, | ||
}) | ||
return applyPlugins<ExtExt, ExtOpts>(extended, pluginSetExtended) | ||
@@ -409,0 +424,0 @@ } |
@@ -17,7 +17,7 @@ import { PromiseWithSubtest, TapPlugin, TestBase, TestBaseOpts } from '@tapjs/core'; | ||
import type { ConfigSet, Jack } from 'jackspeak'; | ||
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> : {}; | ||
type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
@@ -34,8 +34,9 @@ infer S | ||
/** | ||
* Options that may be provided to `t.test()`. Extends {@link Extra}, | ||
* {@link BaseOpts}, {@link TestBaseOpts}, and the second | ||
* argument to all plugin methods currently in use. | ||
* Options that may be provided to `t.test()`. Extends | ||
* {@link @tapjs/core!index.Extra}, {@link @tapjs/core!base.BaseOpts}, | ||
* {@link @tapjs/core!test-base.TestBaseOpts}, and the second argument to all | ||
* plugin methods currently in use. | ||
*/ | ||
export type TestOpts = TestBaseOpts & PluginOpts<PluginSet>; | ||
type PluginSet = [ | ||
export type PluginSet = [ | ||
typeof Plugin_after.plugin, | ||
@@ -174,5 +175,6 @@ typeof Plugin_afterEach.plugin, | ||
/** | ||
* Union type of {@link TestBase} plus all plugin return values | ||
* Union type of {@link @tapjs/core!test-base.TestBase} plus all plugin return | ||
* values | ||
*/ | ||
type TTest<P extends PluginSet = PluginSet> = TestBase & PluginResult<P>; | ||
export type TTest<P extends PluginSet = PluginSet> = TestBase & PluginResult<P>; | ||
/** | ||
@@ -185,3 +187,3 @@ * Interface that is the assembled result of every loaded plugin. | ||
declare const kClass: unique symbol; | ||
type PluginExtensionOption<E extends BuiltPlugins = BuiltPlugins, O extends TestOpts = TestOpts> = { | ||
export type PluginExtensionOption<E extends BuiltPlugins = BuiltPlugins, O extends TestOpts = TestOpts> = { | ||
[kPluginSet]: TapPlugin<any, O>[]; | ||
@@ -191,3 +193,3 @@ [kClass]?: typeof Test<E, O>; | ||
/** | ||
* interface defining the fully extended {@link Test} class. | ||
* interface defining the fully extended {@link @tapjs/test!index.Test} class. | ||
*/ | ||
@@ -199,6 +201,6 @@ export interface Test<Ext extends BuiltPlugins = BuiltPlugins, Opts extends TestOpts = TestOpts> extends TTest { | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -211,3 +213,3 @@ export declare class Test<Ext extends BuiltPlugins = BuiltPlugins, Opts extends TestOpts = TestOpts> extends TestBase implements TTest { | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -217,8 +219,8 @@ * @internal | ||
constructor(opts: Opts, __INTERNAL?: PluginExtensionOption<Ext, Opts>); | ||
get [Symbol.toStringTag](): string; | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -225,0 +227,0 @@ * Typically, it's best to load plugins using configuration, set via the |
@@ -78,3 +78,6 @@ "use strict"; | ||
// } | ||
// type PluginSet = (TapPlugin<any> | TapPlugin<any, TestBaseOpts>)[] | ||
// export type PluginSet = ( | ||
// | TapPlugin<any> | ||
// | TapPlugin<any, TestBaseOpts> | ||
// )[] | ||
const plugins = () => { | ||
@@ -261,9 +264,6 @@ if (plugins_) | ||
})); | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: 'Test', | ||
}); | ||
// assign a reference to the extended Test for use in plugin at run-time | ||
Object.assign(base, { t }); | ||
// put the .t self-ref and plugin inspection on top of the stack | ||
ext.unshift({ | ||
const top = { | ||
t, | ||
@@ -278,3 +278,14 @@ get pluginLoaded() { | ||
}, | ||
}; | ||
ext.unshift(top); | ||
//@ts-ignore | ||
const tst = base[Symbol.toStringTag]; | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(top, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}); | ||
return t; | ||
@@ -285,6 +296,6 @@ }; | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -298,3 +309,3 @@ class Test extends core_1.TestBase { | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -316,12 +327,8 @@ * @internal | ||
/* c8 ignore stop */ | ||
/* c8 ignore start */ | ||
get [Symbol.toStringTag]() { | ||
return 'Test'; | ||
} | ||
/* c8 ignore stop */ | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -361,2 +368,6 @@ * Typically, it's best to load plugins using configuration, set via the | ||
extended.#Class = TestExtended; | ||
Object.defineProperty(TestExtended, 'name', { | ||
value: 'Test', | ||
configurable: true, | ||
}); | ||
return applyPlugins(extended, pluginSetExtended); | ||
@@ -363,0 +374,0 @@ } |
@@ -17,7 +17,7 @@ import { PromiseWithSubtest, TapPlugin, TestBase, TestBaseOpts } from '@tapjs/core'; | ||
import type { ConfigSet, Jack } from 'jackspeak'; | ||
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> : {}; | ||
type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
@@ -34,8 +34,9 @@ infer S | ||
/** | ||
* Options that may be provided to `t.test()`. Extends {@link Extra}, | ||
* {@link BaseOpts}, {@link TestBaseOpts}, and the second | ||
* argument to all plugin methods currently in use. | ||
* Options that may be provided to `t.test()`. Extends | ||
* {@link @tapjs/core!index.Extra}, {@link @tapjs/core!base.BaseOpts}, | ||
* {@link @tapjs/core!test-base.TestBaseOpts}, and the second argument to all | ||
* plugin methods currently in use. | ||
*/ | ||
export type TestOpts = TestBaseOpts & PluginOpts<PluginSet>; | ||
type PluginSet = [ | ||
export type PluginSet = [ | ||
typeof Plugin_after.plugin, | ||
@@ -174,5 +175,6 @@ typeof Plugin_afterEach.plugin, | ||
/** | ||
* Union type of {@link TestBase} plus all plugin return values | ||
* Union type of {@link @tapjs/core!test-base.TestBase} plus all plugin return | ||
* values | ||
*/ | ||
type TTest<P extends PluginSet = PluginSet> = TestBase & PluginResult<P>; | ||
export type TTest<P extends PluginSet = PluginSet> = TestBase & PluginResult<P>; | ||
/** | ||
@@ -185,3 +187,3 @@ * Interface that is the assembled result of every loaded plugin. | ||
declare const kClass: unique symbol; | ||
type PluginExtensionOption<E extends BuiltPlugins = BuiltPlugins, O extends TestOpts = TestOpts> = { | ||
export type PluginExtensionOption<E extends BuiltPlugins = BuiltPlugins, O extends TestOpts = TestOpts> = { | ||
[kPluginSet]: TapPlugin<any, O>[]; | ||
@@ -191,3 +193,3 @@ [kClass]?: typeof Test<E, O>; | ||
/** | ||
* interface defining the fully extended {@link Test} class. | ||
* interface defining the fully extended {@link @tapjs/test!index.Test} class. | ||
*/ | ||
@@ -199,6 +201,6 @@ export interface Test<Ext extends BuiltPlugins = BuiltPlugins, Opts extends TestOpts = TestOpts> extends TTest { | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -211,3 +213,3 @@ export declare class Test<Ext extends BuiltPlugins = BuiltPlugins, Opts extends TestOpts = TestOpts> extends TestBase implements TTest { | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -217,8 +219,8 @@ * @internal | ||
constructor(opts: Opts, __INTERNAL?: PluginExtensionOption<Ext, Opts>); | ||
get [Symbol.toStringTag](): string; | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -225,0 +227,0 @@ * Typically, it's best to load plugins using configuration, set via the |
@@ -52,3 +52,6 @@ //{{HEADER COMMENT START}} | ||
// } | ||
// type PluginSet = (TapPlugin<any> | TapPlugin<any, TestBaseOpts>)[] | ||
// export type PluginSet = ( | ||
// | TapPlugin<any> | ||
// | TapPlugin<any, TestBaseOpts> | ||
// )[] | ||
const plugins = () => { | ||
@@ -234,9 +237,6 @@ if (plugins_) | ||
})); | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: 'Test', | ||
}); | ||
// assign a reference to the extended Test for use in plugin at run-time | ||
Object.assign(base, { t }); | ||
// put the .t self-ref and plugin inspection on top of the stack | ||
ext.unshift({ | ||
const top = { | ||
t, | ||
@@ -251,3 +251,14 @@ get pluginLoaded() { | ||
}, | ||
}; | ||
ext.unshift(top); | ||
//@ts-ignore | ||
const tst = base[Symbol.toStringTag]; | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(top, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}); | ||
return t; | ||
@@ -258,6 +269,6 @@ }; | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -271,3 +282,3 @@ export class Test extends TestBase { | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -289,12 +300,8 @@ * @internal | ||
/* c8 ignore stop */ | ||
/* c8 ignore start */ | ||
get [Symbol.toStringTag]() { | ||
return 'Test'; | ||
} | ||
/* c8 ignore stop */ | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -334,2 +341,6 @@ * Typically, it's best to load plugins using configuration, set via the | ||
extended.#Class = TestExtended; | ||
Object.defineProperty(TestExtended, 'name', { | ||
value: 'Test', | ||
configurable: true, | ||
}); | ||
return applyPlugins(extended, pluginSetExtended); | ||
@@ -336,0 +347,0 @@ } |
@@ -74,9 +74,10 @@ //{{HEADER COMMENT START}} | ||
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> | ||
: {} | ||
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> | ||
: {} | ||
@@ -109,3 +110,3 @@ /** | ||
// options | ||
type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
export type SecondParam<T extends [any] | [any, any]> = T extends [ | ||
any, | ||
@@ -130,5 +131,6 @@ infer S | ||
/** | ||
* Options that may be provided to `t.test()`. Extends {@link Extra}, | ||
* {@link BaseOpts}, {@link TestBaseOpts}, and the second | ||
* argument to all plugin methods currently in use. | ||
* Options that may be provided to `t.test()`. Extends | ||
* {@link @tapjs/core!index.Extra}, {@link @tapjs/core!base.BaseOpts}, | ||
* {@link @tapjs/core!test-base.TestBaseOpts}, and the second argument to all | ||
* plugin methods currently in use. | ||
*/ | ||
@@ -144,3 +146,6 @@ export type TestOpts = TestBaseOpts & PluginOpts<PluginSet> | ||
// } | ||
// type PluginSet = (TapPlugin<any> | TapPlugin<any, TestBaseOpts>)[] | ||
// export type PluginSet = ( | ||
// | TapPlugin<any> | ||
// | TapPlugin<any, TestBaseOpts> | ||
// )[] | ||
const plugins = () => { | ||
@@ -166,3 +171,3 @@ if (plugins_) return plugins_ | ||
type PluginSet = [ | ||
export type PluginSet = [ | ||
typeof Plugin_after.plugin, | ||
@@ -269,5 +274,6 @@ typeof Plugin_afterEach.plugin, | ||
/** | ||
* Union type of {@link TestBase} plus all plugin return values | ||
* Union type of {@link @tapjs/core!test-base.TestBase} plus all plugin return | ||
* values | ||
*/ | ||
type TTest<P extends PluginSet = PluginSet> = TestBase & | ||
export type TTest<P extends PluginSet = PluginSet> = TestBase & | ||
PluginResult<P> | ||
@@ -372,9 +378,7 @@ | ||
) | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: 'Test', | ||
}) | ||
// assign a reference to the extended Test for use in plugin at run-time | ||
Object.assign(base, { t }) | ||
// put the .t self-ref and plugin inspection on top of the stack | ||
ext.unshift({ | ||
const top = { | ||
t, | ||
@@ -391,3 +395,15 @@ get pluginLoaded() { | ||
}, | ||
} | ||
ext.unshift(top) | ||
//@ts-ignore | ||
const tst: string = base[Symbol.toStringTag] | ||
Object.defineProperty(t, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}) | ||
Object.defineProperty(top, Symbol.toStringTag, { | ||
value: tst, | ||
configurable: true, | ||
}) | ||
return t | ||
@@ -398,3 +414,3 @@ } | ||
const kClass = Symbol('@tapjs/test construction class') | ||
type PluginExtensionOption< | ||
export type PluginExtensionOption< | ||
E extends BuiltPlugins = BuiltPlugins, | ||
@@ -408,3 +424,3 @@ O extends TestOpts = TestOpts | ||
/** | ||
* interface defining the fully extended {@link Test} class. | ||
* interface defining the fully extended {@link @tapjs/test!index.Test} class. | ||
*/ | ||
@@ -420,6 +436,6 @@ export interface Test< | ||
/** | ||
* This is the class that is extended for the root {@link TAP} test, | ||
* and used to instantiate test objects in its child tests. It extends | ||
* {@link TestBase}, and implements the union of return values of all | ||
* loaded plugins via a Proxy. | ||
* This is the class that is extended for the root {@link @tapjs/core!tap.TAP} | ||
* test, and used to instantiate test objects in its child tests. It extends | ||
* {@link @tapjs/core!test-base.TestBase}, and implements the union of return | ||
* values of all loaded plugins via a Proxy. | ||
*/ | ||
@@ -440,3 +456,3 @@ export class Test< | ||
* @param __INTERNAL Extension option used by the subclasses created in | ||
* {@link Test#applyPlugin}. | ||
* {@link @tapjs/test!index.Test#applyPlugin}. | ||
* | ||
@@ -463,13 +479,8 @@ * @internal | ||
/* c8 ignore start */ | ||
get [Symbol.toStringTag]() { | ||
return 'Test' | ||
} | ||
/* c8 ignore stop */ | ||
/** | ||
* Add a plugin at run-time. | ||
* | ||
* Creates a subclass of {@link Test} which has the specified | ||
* plugin, and which applies the plugin to all child tests it creates. | ||
* Creates a subclass of {@link @tapjs/test!index.Test} which has the | ||
* specified plugin, and which applies the plugin to all child tests it | ||
* creates. | ||
* | ||
@@ -522,2 +533,6 @@ * Typically, it's best to load plugins using configuration, set via the | ||
extended.#Class = TestExtended | ||
Object.defineProperty(TestExtended, 'name', { | ||
value: 'Test', | ||
configurable: true, | ||
}) | ||
return applyPlugins<ExtExt, ExtOpts>(extended, pluginSetExtended) | ||
@@ -524,0 +539,0 @@ } |
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
177382
2601
+ Added@tapjs/core@0.0.0-12(transitive)
+ Added@tapjs/stack@0.0.0-4(transitive)
+ Addedtap-parser@15.0.0-2(transitive)
+ Addedtcompare@6.0.1-3(transitive)
- Removed@tapjs/core@0.0.0-11(transitive)
- Removed@tapjs/stack@0.0.0-3(transitive)
- Removedtap-parser@15.0.0-1(transitive)
- Removedtcompare@6.0.1-2(transitive)
Updatedglob@^10.3.3
Updatedtap-parser@15.0.0-2
Updatedtypescript@^5.1.6