Socket
Socket
Sign inDemoInstall

@tapjs/core

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/core - npm Package Compare versions

Comparing version 0.0.0-11 to 0.0.0-12

24

dist/cjs/base.d.ts

@@ -313,4 +313,5 @@ /**

/**
* Run the `main` test function. Called by {@link TestBase} when
* starting a subtest. Initializes the TapWrap hook
* Run the `main` test function. Called by
* {@link @tapjs/core!test-base.TestBase} when starting a subtest.
* Initializes the TapWrap hook
*

@@ -337,4 +338,5 @@ * @internal

* For buffered tests, this collects the output in the
* {@link Base#output}
* field. Sets {@link Base#printedOutput} to `true` when called.
* {@link @tapjs/core!base.Base#output}
* field. Sets {@link @tapjs/core!base.Base#printedOutput} to `true` when
* called.
*/

@@ -345,3 +347,3 @@ write(c: string): boolean;

*
* Extended by {@link TestBase}
* Extended by {@link @tapjs/core!test-base.TestBase}
*/

@@ -352,3 +354,4 @@ onbail(reason?: string): void;

*
* Extended by {@link Worker} and {@link TAP} classes
* Extended by {@link @tapjs/core!worker.Worker} and
* {@link @tapjs/core!tap.TAP} classes
*/

@@ -377,4 +380,5 @@ oncomplete(results: FinalResults): void;

/**
* EventEmitter emit method, but closes the {@link Base#hook} and
* {@link Base#hookDomain} when emitting `'end'`.
* EventEmitter emit method, but closes the
* {@link @tapjs/core!base.Base#hook} and
* {@link @tapjs/core!base.Base#hookDomain} when emitting `'end'`.
*/

@@ -384,4 +388,4 @@ emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean;

* Mark the test as ended. In this base class, this is a no-op, but
* in {@link TestBase}, it also triggers the other end-of-test
* operations.
* in {@link @tapjs/core!test-base.TestBase}, it also triggers the other
* end-of-test operations.
*/

@@ -388,0 +392,0 @@ end(): this;

@@ -179,2 +179,9 @@ "use strict";

super({ encoding: 'utf8' });
// always use the constructor name as toStringTag, so we get
// [object Test] or [object TAP] and the appropriate typeName
// in stack traces.
Object.defineProperty(this, Symbol.toStringTag, {
value: this.constructor.name,
configurable: true,
});
// all tap streams are sync string minipasses

@@ -325,4 +332,5 @@ this.hook = new TapWrap(this);

/**
* Run the `main` test function. Called by {@link TestBase} when
* starting a subtest. Initializes the TapWrap hook
* Run the `main` test function. Called by
* {@link @tapjs/core!test-base.TestBase} when starting a subtest.
* Initializes the TapWrap hook
*

@@ -360,4 +368,5 @@ * @internal

* For buffered tests, this collects the output in the
* {@link Base#output}
* field. Sets {@link Base#printedOutput} to `true` when called.
* {@link @tapjs/core!base.Base#output}
* field. Sets {@link @tapjs/core!base.Base#printedOutput} to `true` when
* called.
*/

@@ -375,3 +384,3 @@ write(c) {

*
* Extended by {@link TestBase}
* Extended by {@link @tapjs/core!test-base.TestBase}
*/

@@ -394,3 +403,4 @@ onbail(reason) {

*
* Extended by {@link Worker} and {@link TAP} classes
* Extended by {@link @tapjs/core!worker.Worker} and
* {@link @tapjs/core!tap.TAP} classes
*/

@@ -445,4 +455,5 @@ oncomplete(results) {

/**
* EventEmitter emit method, but closes the {@link Base#hook} and
* {@link Base#hookDomain} when emitting `'end'`.
* EventEmitter emit method, but closes the
* {@link @tapjs/core!base.Base#hook} and
* {@link @tapjs/core!base.Base#hookDomain} when emitting `'end'`.
*/

@@ -460,4 +471,4 @@ emit(ev, ...data) {

* Mark the test as ended. In this base class, this is a no-op, but
* in {@link TestBase}, it also triggers the other end-of-test
* operations.
* in {@link @tapjs/core!test-base.TestBase}, it also triggers the other
* end-of-test operations.
*/

@@ -464,0 +475,0 @@ end() {

/**
* JSON object representation of {@link Counts}
* JSON object representation of {@link @tapjs/core!counts.Counts}
*/

@@ -15,3 +15,3 @@ export interface CountsJSON {

*
* The {@link Counts#complete} field is only used when counting tests and
* The {@link @tapjs/core!counts.Counts#complete} field is only used when counting tests and
* tracking their completion status.

@@ -18,0 +18,0 @@ *

@@ -7,3 +7,3 @@ "use strict";

*
* The {@link Counts#complete} field is only used when counting tests and
* The {@link @tapjs/core!counts.Counts#complete} field is only used when counting tests and
* tracking their completion status.

@@ -10,0 +10,0 @@ *

import { Extra } from './index.js';
/**
* Print the YAML diagnostics based on the {@link Extra} object
* received
* Print the YAML diagnostics based on the {@link @tapjs/core!index.Extra}
* object received
*/
export declare const diags: (obj: Extra) => string;
//# sourceMappingURL=diags.d.ts.map

@@ -10,4 +10,4 @@ "use strict";

/**
* Print the YAML diagnostics based on the {@link Extra} object
* received
* Print the YAML diagnostics based on the {@link @tapjs/core!index.Extra}
* object received
*/

@@ -14,0 +14,0 @@ const diags = (obj) => {

import type { BaseOpts } from './base.js';
import { Extra } from './index.js';
/**
* Create an {@link Extra} object based on a thrown Error
* Create an {@link @tapjs/core!index.Extra} object based on a thrown Error
*/
export declare const extraFromError: (er: any, extra?: Extra, options?: BaseOpts) => Extra;
//# sourceMappingURL=extra-from-error.d.ts.map

@@ -29,3 +29,3 @@ "use strict";

/**
* Create an {@link Extra} object based on a thrown Error
* Create an {@link @tapjs/core!index.Extra} object based on a thrown Error
*/

@@ -32,0 +32,0 @@ const extraFromError = (er, extra, options) => {

import { Result } from 'tap-parser';
/**
* List of {@link Result} objects corresponding to test points
* encountered in a TAP stream.
* List of {@link tap-parser!result.Result} objects corresponding to test
* points encountered in a TAP stream.
*/

@@ -6,0 +6,0 @@ export declare class Lists {

@@ -5,4 +5,4 @@ "use strict";

/**
* List of {@link Result} objects corresponding to test points
* encountered in a TAP stream.
* List of {@link tap-parser!result.Result} objects corresponding to test
* points encountered in a TAP stream.
*/

@@ -9,0 +9,0 @@ class Lists {

import { Extra, MessageExtra } from './index.js';
/**
* Normalize the {@link MessageExtra} arguments to test assertion
* methods
* Normalize the {@link @tapjs/core!index.MessageExtra} arguments to test
* assertion methods
*/
export declare const normalizeMessageExtra: (defaultMessage: string, [message, extra]: MessageExtra) => [string, Extra];
//# sourceMappingURL=normalize-message-extra.d.ts.map

@@ -5,4 +5,4 @@ "use strict";

/**
* Normalize the {@link MessageExtra} arguments to test assertion
* methods
* Normalize the {@link @tapjs/core!index.MessageExtra} arguments to test
* assertion methods
*/

@@ -9,0 +9,0 @@ const normalizeMessageExtra = (defaultMessage, [message, extra]) => {

@@ -15,3 +15,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Events emitted by the {@link Spawn} class
* Events emitted by the {@link @tapjs/core!spawn.Spawn} class
*/

@@ -31,3 +31,3 @@ export interface SpawnEvents extends TapBaseEvents {

/**
* Options that may be provided to the {@link Spawn} class
* Options that may be provided to the {@link @tapjs/core!spawn.Spawn} class
*/

@@ -34,0 +34,0 @@ export interface SpawnOpts extends TestBaseOpts {

@@ -6,3 +6,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Options that may be provided to the {@link Stdin} class
* Options that may be provided to the {@link @tapjs/core!stdin.Stdin} class
*/

@@ -9,0 +9,0 @@ export interface StdinOpts extends BaseOpts {

@@ -6,9 +6,10 @@ /// <reference types="node" resolution-mode="require"/>

*
* Inherits from {@link Test}, with all plugins applied, and has additional
* functionality to automatically pipe to standard output, set the process
* exit code appropriately, and infer options from environment variables.
* Inherits from {@link @tapjs/test!index.Test}, with all plugins applied, and
* has additional functionality to automatically pipe to standard output, set
* the process exit code appropriately, and infer options from environment
* variables.
*
* @module
*
* @see {@link TAP}
* @see {@link @tapjs/core!tap.TAP}
*/

@@ -22,5 +23,6 @@ import { Test, TestOpts } from '@tapjs/test';

/**
* This is a singleton subclass of the {@link Test} base class.
* This is a singleton subclass of the {@link @tapjs/test!index.Test} base
* class.
*
* Instantiate it by calling the exported {@link tap} method.
* Instantiate it by calling the exported {@link @tapjs/core!tap.tap} method.
*

@@ -31,3 +33,3 @@ * It has all of the same plugins, fields, properties etc of a "normal"

*
* - The {@link TAP#register} method will hook onto the process
* - The {@link @tapjs/core!tap.TAP#register} method will hook onto the process
* object, to set the exit code to 1 if there are test failures, and ignore

@@ -87,7 +89,7 @@ * any `EPIPE` errors that happen on stdout. (This is quite common in cases

/**
* Similar to the normal {@link TestBase#timeout}, but with the added
* feature that it will kill the process with `SIGALRM` if it has been
* registered, and will decorate the diagnostics with some information
* about currently running handles and requests, as these may be the
* reason the process is not gracefully closing in time.
* Similar to the normal {@link @tapjs/core!test-base.TestBase#timeout}, but
* with the added feature that it will kill the process with `SIGALRM` if it
* has been registered, and will decorate the diagnostics with some
* information about currently running handles and requests, as these may be
* the reason the process is not gracefully closing in time.
*

@@ -104,4 +106,5 @@ * The root test runner will time out if the process receives a `SIGALRM`

/**
* The exported function instantiates a {@link TAP} object if we don't
* already have one, or return the one that was previously instantiated.
* The exported function instantiates a {@link @tapjs/core!tap.TAP} object if
* we don't already have one, or return the one that was previously
* instantiated.
*

@@ -108,0 +111,0 @@ * Options may be provided, which will override the environment settings,

@@ -8,9 +8,10 @@ "use strict";

*
* Inherits from {@link Test}, with all plugins applied, and has additional
* functionality to automatically pipe to standard output, set the process
* exit code appropriately, and infer options from environment variables.
* Inherits from {@link @tapjs/test!index.Test}, with all plugins applied, and
* has additional functionality to automatically pipe to standard output, set
* the process exit code appropriately, and infer options from environment
* variables.
*
* @module
*
* @see {@link TAP}
* @see {@link @tapjs/core!tap.TAP}
*/

@@ -36,5 +37,6 @@ const test_1 = require("@tapjs/test");

/**
* This is a singleton subclass of the {@link Test} base class.
* This is a singleton subclass of the {@link @tapjs/test!index.Test} base
* class.
*
* Instantiate it by calling the exported {@link tap} method.
* Instantiate it by calling the exported {@link @tapjs/core!tap.tap} method.
*

@@ -45,3 +47,3 @@ * It has all of the same plugins, fields, properties etc of a "normal"

*
* - The {@link TAP#register} method will hook onto the process
* - The {@link @tapjs/core!tap.TAP#register} method will hook onto the process
* object, to set the exit code to 1 if there are test failures, and ignore

@@ -192,7 +194,7 @@ * any `EPIPE` errors that happen on stdout. (This is quite common in cases

/**
* Similar to the normal {@link TestBase#timeout}, but with the added
* feature that it will kill the process with `SIGALRM` if it has been
* registered, and will decorate the diagnostics with some information
* about currently running handles and requests, as these may be the
* reason the process is not gracefully closing in time.
* Similar to the normal {@link @tapjs/core!test-base.TestBase#timeout}, but
* with the added feature that it will kill the process with `SIGALRM` if it
* has been registered, and will decorate the diagnostics with some
* information about currently running handles and requests, as these may be
* the reason the process is not gracefully closing in time.
*

@@ -398,4 +400,5 @@ * The root test runner will time out if the process receives a `SIGALRM`

/**
* The exported function instantiates a {@link TAP} object if we don't
* already have one, or return the one that was previously instantiated.
* The exported function instantiates a {@link @tapjs/core!tap.TAP} object if
* we don't already have one, or return the one that was previously
* instantiated.
*

@@ -402,0 +405,0 @@ * Options may be provided, which will override the environment settings,

@@ -39,3 +39,4 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Entries in the {@link TestBase#queue} awaiting processing
* Entries in the {@link @tapjs/core!test-base.TestBase#queue} awaiting
* processing
*/

@@ -119,3 +120,4 @@ export type QueueEntry = string | TestPoint | Base | typeof EOF | Waiter | [method: string, ...args: any[]] | (() => any);

* for anything, with nothing in its queue. Used by the root
* {@link TAP} singleton to know when to automatically terminate.
* {@link @tapjs/core!tap.TAP} singleton to know when to automatically
* terminate.
*

@@ -127,3 +129,4 @@ * @event

/**
* The TestBase class is the parent class of {@link Test}, and passed
* The TestBase class is the parent class of {@link @tapjs/test!index.Test},
* and passed
* to all plugins at instantiation time.

@@ -150,12 +153,39 @@ *

};
/**
* The number of subtests to run in parallel, if allowed
*/
jobs: number;
/**
* Array of all subtests that have been added/scheduled,
* and have not yet completed.
*/
subtests: Base[];
/**
* The pool of parallel tests currently in process
*/
pool: Set<Base>;
/**
* Queue of items awaiting processing. Can be any
* {@link @tapjs/core!test-base.QueueEntry} item.
*/
queue: QueueEntry[];
/**
* Function that will get this test as an argument when it is processed
*/
cb?: (...args: any[]) => any;
/**
* The count of all assertions this test has seen
*/
count: number;
/**
* Set true when {@link @tapjs/core!test-base.TestBase#end} is called
*/
ended: boolean;
/**
* Show diagnostics for this test. A value of `null` means that
* diagnostics will be shown only if the test is failing.
*/
diagnostic: null | boolean;
/**
* Subtests that are currently in process
* Subtests that are currently in process.
*/

@@ -316,5 +346,6 @@ activeSubtests: Set<Base>;

*
* No need to ever call this directly, exposed so that it can be extended
* by {@link Spawn} and {@link Worker}, which have special behaviors
* that are required when a process hangs indefinitely.
* No need to ever call this directly, exposed so that it can be extended by
* {@link @tapjs/core!spawn.Spawn} and {@link @tapjs/core!worker.Worker},
* which have special behaviors that are required when a process hangs
* indefinitely.
*/

@@ -321,0 +352,0 @@ endAll(sub?: boolean): void;

@@ -56,3 +56,4 @@ "use strict";

/**
* The TestBase class is the parent class of {@link Test}, and passed
* The TestBase class is the parent class of {@link @tapjs/test!index.Test},
* and passed
* to all plugins at instantiation time.

@@ -74,9 +75,36 @@ *

donePromise;
/**
* The number of subtests to run in parallel, if allowed
*/
jobs;
/**
* Array of all subtests that have been added/scheduled,
* and have not yet completed.
*/
subtests = [];
/**
* The pool of parallel tests currently in process
*/
pool = new Set();
/**
* Queue of items awaiting processing. Can be any
* {@link @tapjs/core!test-base.QueueEntry} item.
*/
queue = [VERSION];
/**
* Function that will get this test as an argument when it is processed
*/
cb;
/**
* The count of all assertions this test has seen
*/
count = 0;
/**
* Set true when {@link @tapjs/core!test-base.TestBase#end} is called
*/
ended = false;
/**
* Show diagnostics for this test. A value of `null` means that
* diagnostics will be shown only if the test is failing.
*/
diagnostic = null;

@@ -100,3 +128,3 @@ #planEnd = -1;

/**
* Subtests that are currently in process
* Subtests that are currently in process.
*/

@@ -703,3 +731,2 @@ activeSubtests = new Set();

this.debug('%s.#onBufferedEnd', this.name, p.name, p.results.bailout);
this.pool.delete(p);
p.options.tapChildBuffer = p.output || '';

@@ -711,2 +738,3 @@ p.options.stack = '';

this.#occupied = null;
this.pool.delete(p);
this.activeSubtests.delete(p);

@@ -1053,5 +1081,6 @@ p.deferred?.resolve(p.results);

*
* No need to ever call this directly, exposed so that it can be extended
* by {@link Spawn} and {@link Worker}, which have special behaviors
* that are required when a process hangs indefinitely.
* No need to ever call this directly, exposed so that it can be extended by
* {@link @tapjs/core!spawn.Spawn} and {@link @tapjs/core!worker.Worker},
* which have special behaviors that are required when a process hangs
* indefinitely.
*/

@@ -1058,0 +1087,0 @@ endAll(sub = false) {

import { Extra } from './index.js';
/**
* Very simple result object, just indicating pass/fail status,
* message, and the {@link Extra} object provided to the assertion method.
* message, and the {@link @tapjs/core!index.Extra} object provided to the
* assertion method.
*/

@@ -6,0 +7,0 @@ export interface Result {

/**
* Basically a fancy Deferred, wrapped around an existing promise, used by
* the {@link TestBase#waitOn | t.waitOn} method, and tracked in the
* {@link TestBase#queue}.
* the {@link @tapjs/core!test-base.TestBase#waitOn} method, and
* tracked in the {@link @tapjs/core!test-base.TestBase#queue}.
*

@@ -52,3 +52,3 @@ * The callback function is called when it's been either resolved or

* Called when the waiter is ready, and processed by its owning
* {@link TestBase}
* {@link @tapjs/core!test-base.TestBase}
*/

@@ -55,0 +55,0 @@ finish(): void;

@@ -6,4 +6,4 @@ "use strict";

* Basically a fancy Deferred, wrapped around an existing promise, used by
* the {@link TestBase#waitOn | t.waitOn} method, and tracked in the
* {@link TestBase#queue}.
* the {@link @tapjs/core!test-base.TestBase#waitOn} method, and
* tracked in the {@link @tapjs/core!test-base.TestBase#queue}.
*

@@ -100,3 +100,3 @@ * The callback function is called when it's been either resolved or

* Called when the waiter is ready, and processed by its owning
* {@link TestBase}
* {@link @tapjs/core!test-base.TestBase}
*/

@@ -103,0 +103,0 @@ finish() {

@@ -9,3 +9,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Events emitted by {@link Worker} instances
* Events emitted by {@link @tapjs/core!worker.Worker} instances
*/

@@ -16,8 +16,8 @@ export interface WorkerEvents extends TapBaseEvents {

/**
* Options that can be provided to a {@link Worker}
* Options that can be provided to a {@link @tapjs/core!worker.Worker}
*/
export interface WorkerOpts extends TestBaseOpts {
/**
* Data that will be available on `t.workerData` on the root {@link TAP}
* object in the worker thread.
* Data that will be available on `t.workerData` on the root
* {@link @tapjs/core!tap.TAP} object in the worker thread.
*/

@@ -24,0 +24,0 @@ workerData?: any;

@@ -313,4 +313,5 @@ /**

/**
* Run the `main` test function. Called by {@link TestBase} when
* starting a subtest. Initializes the TapWrap hook
* Run the `main` test function. Called by
* {@link @tapjs/core!test-base.TestBase} when starting a subtest.
* Initializes the TapWrap hook
*

@@ -337,4 +338,5 @@ * @internal

* For buffered tests, this collects the output in the
* {@link Base#output}
* field. Sets {@link Base#printedOutput} to `true` when called.
* {@link @tapjs/core!base.Base#output}
* field. Sets {@link @tapjs/core!base.Base#printedOutput} to `true` when
* called.
*/

@@ -345,3 +347,3 @@ write(c: string): boolean;

*
* Extended by {@link TestBase}
* Extended by {@link @tapjs/core!test-base.TestBase}
*/

@@ -352,3 +354,4 @@ onbail(reason?: string): void;

*
* Extended by {@link Worker} and {@link TAP} classes
* Extended by {@link @tapjs/core!worker.Worker} and
* {@link @tapjs/core!tap.TAP} classes
*/

@@ -377,4 +380,5 @@ oncomplete(results: FinalResults): void;

/**
* EventEmitter emit method, but closes the {@link Base#hook} and
* {@link Base#hookDomain} when emitting `'end'`.
* EventEmitter emit method, but closes the
* {@link @tapjs/core!base.Base#hook} and
* {@link @tapjs/core!base.Base#hookDomain} when emitting `'end'`.
*/

@@ -384,4 +388,4 @@ emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean;

* Mark the test as ended. In this base class, this is a no-op, but
* in {@link TestBase}, it also triggers the other end-of-test
* operations.
* in {@link @tapjs/core!test-base.TestBase}, it also triggers the other
* end-of-test operations.
*/

@@ -388,0 +392,0 @@ end(): this;

@@ -175,2 +175,9 @@ /**

super({ encoding: 'utf8' });
// always use the constructor name as toStringTag, so we get
// [object Test] or [object TAP] and the appropriate typeName
// in stack traces.
Object.defineProperty(this, Symbol.toStringTag, {
value: this.constructor.name,
configurable: true,
});
// all tap streams are sync string minipasses

@@ -321,4 +328,5 @@ this.hook = new TapWrap(this);

/**
* Run the `main` test function. Called by {@link TestBase} when
* starting a subtest. Initializes the TapWrap hook
* Run the `main` test function. Called by
* {@link @tapjs/core!test-base.TestBase} when starting a subtest.
* Initializes the TapWrap hook
*

@@ -356,4 +364,5 @@ * @internal

* For buffered tests, this collects the output in the
* {@link Base#output}
* field. Sets {@link Base#printedOutput} to `true` when called.
* {@link @tapjs/core!base.Base#output}
* field. Sets {@link @tapjs/core!base.Base#printedOutput} to `true` when
* called.
*/

@@ -371,3 +380,3 @@ write(c) {

*
* Extended by {@link TestBase}
* Extended by {@link @tapjs/core!test-base.TestBase}
*/

@@ -390,3 +399,4 @@ onbail(reason) {

*
* Extended by {@link Worker} and {@link TAP} classes
* Extended by {@link @tapjs/core!worker.Worker} and
* {@link @tapjs/core!tap.TAP} classes
*/

@@ -441,4 +451,5 @@ oncomplete(results) {

/**
* EventEmitter emit method, but closes the {@link Base#hook} and
* {@link Base#hookDomain} when emitting `'end'`.
* EventEmitter emit method, but closes the
* {@link @tapjs/core!base.Base#hook} and
* {@link @tapjs/core!base.Base#hookDomain} when emitting `'end'`.
*/

@@ -456,4 +467,4 @@ emit(ev, ...data) {

* Mark the test as ended. In this base class, this is a no-op, but
* in {@link TestBase}, it also triggers the other end-of-test
* operations.
* in {@link @tapjs/core!test-base.TestBase}, it also triggers the other
* end-of-test operations.
*/

@@ -460,0 +471,0 @@ end() {

/**
* JSON object representation of {@link Counts}
* JSON object representation of {@link @tapjs/core!counts.Counts}
*/

@@ -15,3 +15,3 @@ export interface CountsJSON {

*
* The {@link Counts#complete} field is only used when counting tests and
* The {@link @tapjs/core!counts.Counts#complete} field is only used when counting tests and
* tracking their completion status.

@@ -18,0 +18,0 @@ *

/**
* Class representing a count of all the assertions in a test
*
* The {@link Counts#complete} field is only used when counting tests and
* The {@link @tapjs/core!counts.Counts#complete} field is only used when counting tests and
* tracking their completion status.

@@ -6,0 +6,0 @@ *

import { Extra } from './index.js';
/**
* Print the YAML diagnostics based on the {@link Extra} object
* received
* Print the YAML diagnostics based on the {@link @tapjs/core!index.Extra}
* object received
*/
export declare const diags: (obj: Extra) => string;
//# sourceMappingURL=diags.d.ts.map
import yaml from 'tap-yaml';
import { cleanYamlObject } from './clean-yaml-object.js';
/**
* Print the YAML diagnostics based on the {@link Extra} object
* received
* Print the YAML diagnostics based on the {@link @tapjs/core!index.Extra}
* object received
*/

@@ -7,0 +7,0 @@ export const diags = (obj) => {

import type { BaseOpts } from './base.js';
import { Extra } from './index.js';
/**
* Create an {@link Extra} object based on a thrown Error
* Create an {@link @tapjs/core!index.Extra} object based on a thrown Error
*/
export declare const extraFromError: (er: any, extra?: Extra, options?: BaseOpts) => Extra;
//# sourceMappingURL=extra-from-error.d.ts.map
import * as stack from '@tapjs/stack';
/**
* Create an {@link Extra} object based on a thrown Error
* Create an {@link @tapjs/core!index.Extra} object based on a thrown Error
*/

@@ -5,0 +5,0 @@ export const extraFromError = (er, extra, options) => {

import { Result } from 'tap-parser';
/**
* List of {@link Result} objects corresponding to test points
* encountered in a TAP stream.
* List of {@link tap-parser!result.Result} objects corresponding to test
* points encountered in a TAP stream.
*/

@@ -6,0 +6,0 @@ export declare class Lists {

/**
* List of {@link Result} objects corresponding to test points
* encountered in a TAP stream.
* List of {@link tap-parser!result.Result} objects corresponding to test
* points encountered in a TAP stream.
*/

@@ -5,0 +5,0 @@ export class Lists {

import { Extra, MessageExtra } from './index.js';
/**
* Normalize the {@link MessageExtra} arguments to test assertion
* methods
* Normalize the {@link @tapjs/core!index.MessageExtra} arguments to test
* assertion methods
*/
export declare const normalizeMessageExtra: (defaultMessage: string, [message, extra]: MessageExtra) => [string, Extra];
//# sourceMappingURL=normalize-message-extra.d.ts.map
/**
* Normalize the {@link MessageExtra} arguments to test assertion
* methods
* Normalize the {@link @tapjs/core!index.MessageExtra} arguments to test
* assertion methods
*/

@@ -5,0 +5,0 @@ export const normalizeMessageExtra = (defaultMessage, [message, extra]) => {

@@ -15,3 +15,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Events emitted by the {@link Spawn} class
* Events emitted by the {@link @tapjs/core!spawn.Spawn} class
*/

@@ -31,3 +31,3 @@ export interface SpawnEvents extends TapBaseEvents {

/**
* Options that may be provided to the {@link Spawn} class
* Options that may be provided to the {@link @tapjs/core!spawn.Spawn} class
*/

@@ -34,0 +34,0 @@ export interface SpawnOpts extends TestBaseOpts {

@@ -6,3 +6,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Options that may be provided to the {@link Stdin} class
* Options that may be provided to the {@link @tapjs/core!stdin.Stdin} class
*/

@@ -9,0 +9,0 @@ export interface StdinOpts extends BaseOpts {

@@ -6,9 +6,10 @@ /// <reference types="node" resolution-mode="require"/>

*
* Inherits from {@link Test}, with all plugins applied, and has additional
* functionality to automatically pipe to standard output, set the process
* exit code appropriately, and infer options from environment variables.
* Inherits from {@link @tapjs/test!index.Test}, with all plugins applied, and
* has additional functionality to automatically pipe to standard output, set
* the process exit code appropriately, and infer options from environment
* variables.
*
* @module
*
* @see {@link TAP}
* @see {@link @tapjs/core!tap.TAP}
*/

@@ -22,5 +23,6 @@ import { Test, TestOpts } from '@tapjs/test';

/**
* This is a singleton subclass of the {@link Test} base class.
* This is a singleton subclass of the {@link @tapjs/test!index.Test} base
* class.
*
* Instantiate it by calling the exported {@link tap} method.
* Instantiate it by calling the exported {@link @tapjs/core!tap.tap} method.
*

@@ -31,3 +33,3 @@ * It has all of the same plugins, fields, properties etc of a "normal"

*
* - The {@link TAP#register} method will hook onto the process
* - The {@link @tapjs/core!tap.TAP#register} method will hook onto the process
* object, to set the exit code to 1 if there are test failures, and ignore

@@ -87,7 +89,7 @@ * any `EPIPE` errors that happen on stdout. (This is quite common in cases

/**
* Similar to the normal {@link TestBase#timeout}, but with the added
* feature that it will kill the process with `SIGALRM` if it has been
* registered, and will decorate the diagnostics with some information
* about currently running handles and requests, as these may be the
* reason the process is not gracefully closing in time.
* Similar to the normal {@link @tapjs/core!test-base.TestBase#timeout}, but
* with the added feature that it will kill the process with `SIGALRM` if it
* has been registered, and will decorate the diagnostics with some
* information about currently running handles and requests, as these may be
* the reason the process is not gracefully closing in time.
*

@@ -104,4 +106,5 @@ * The root test runner will time out if the process receives a `SIGALRM`

/**
* The exported function instantiates a {@link TAP} object if we don't
* already have one, or return the one that was previously instantiated.
* The exported function instantiates a {@link @tapjs/core!tap.TAP} object if
* we don't already have one, or return the one that was previously
* instantiated.
*

@@ -108,0 +111,0 @@ * Options may be provided, which will override the environment settings,

@@ -5,9 +5,10 @@ /**

*
* Inherits from {@link Test}, with all plugins applied, and has additional
* functionality to automatically pipe to standard output, set the process
* exit code appropriately, and infer options from environment variables.
* Inherits from {@link @tapjs/test!index.Test}, with all plugins applied, and
* has additional functionality to automatically pipe to standard output, set
* the process exit code appropriately, and infer options from environment
* variables.
*
* @module
*
* @see {@link TAP}
* @see {@link @tapjs/core!tap.TAP}
*/

@@ -33,5 +34,6 @@ import { Test } from '@tapjs/test';

/**
* This is a singleton subclass of the {@link Test} base class.
* This is a singleton subclass of the {@link @tapjs/test!index.Test} base
* class.
*
* Instantiate it by calling the exported {@link tap} method.
* Instantiate it by calling the exported {@link @tapjs/core!tap.tap} method.
*

@@ -42,3 +44,3 @@ * It has all of the same plugins, fields, properties etc of a "normal"

*
* - The {@link TAP#register} method will hook onto the process
* - The {@link @tapjs/core!tap.TAP#register} method will hook onto the process
* object, to set the exit code to 1 if there are test failures, and ignore

@@ -189,7 +191,7 @@ * any `EPIPE` errors that happen on stdout. (This is quite common in cases

/**
* Similar to the normal {@link TestBase#timeout}, but with the added
* feature that it will kill the process with `SIGALRM` if it has been
* registered, and will decorate the diagnostics with some information
* about currently running handles and requests, as these may be the
* reason the process is not gracefully closing in time.
* Similar to the normal {@link @tapjs/core!test-base.TestBase#timeout}, but
* with the added feature that it will kill the process with `SIGALRM` if it
* has been registered, and will decorate the diagnostics with some
* information about currently running handles and requests, as these may be
* the reason the process is not gracefully closing in time.
*

@@ -395,4 +397,5 @@ * The root test runner will time out if the process receives a `SIGALRM`

/**
* The exported function instantiates a {@link TAP} object if we don't
* already have one, or return the one that was previously instantiated.
* The exported function instantiates a {@link @tapjs/core!tap.TAP} object if
* we don't already have one, or return the one that was previously
* instantiated.
*

@@ -399,0 +402,0 @@ * Options may be provided, which will override the environment settings,

@@ -39,3 +39,4 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Entries in the {@link TestBase#queue} awaiting processing
* Entries in the {@link @tapjs/core!test-base.TestBase#queue} awaiting
* processing
*/

@@ -119,3 +120,4 @@ export type QueueEntry = string | TestPoint | Base | typeof EOF | Waiter | [method: string, ...args: any[]] | (() => any);

* for anything, with nothing in its queue. Used by the root
* {@link TAP} singleton to know when to automatically terminate.
* {@link @tapjs/core!tap.TAP} singleton to know when to automatically
* terminate.
*

@@ -127,3 +129,4 @@ * @event

/**
* The TestBase class is the parent class of {@link Test}, and passed
* The TestBase class is the parent class of {@link @tapjs/test!index.Test},
* and passed
* to all plugins at instantiation time.

@@ -150,12 +153,39 @@ *

};
/**
* The number of subtests to run in parallel, if allowed
*/
jobs: number;
/**
* Array of all subtests that have been added/scheduled,
* and have not yet completed.
*/
subtests: Base[];
/**
* The pool of parallel tests currently in process
*/
pool: Set<Base>;
/**
* Queue of items awaiting processing. Can be any
* {@link @tapjs/core!test-base.QueueEntry} item.
*/
queue: QueueEntry[];
/**
* Function that will get this test as an argument when it is processed
*/
cb?: (...args: any[]) => any;
/**
* The count of all assertions this test has seen
*/
count: number;
/**
* Set true when {@link @tapjs/core!test-base.TestBase#end} is called
*/
ended: boolean;
/**
* Show diagnostics for this test. A value of `null` means that
* diagnostics will be shown only if the test is failing.
*/
diagnostic: null | boolean;
/**
* Subtests that are currently in process
* Subtests that are currently in process.
*/

@@ -316,5 +346,6 @@ activeSubtests: Set<Base>;

*
* No need to ever call this directly, exposed so that it can be extended
* by {@link Spawn} and {@link Worker}, which have special behaviors
* that are required when a process hangs indefinitely.
* No need to ever call this directly, exposed so that it can be extended by
* {@link @tapjs/core!spawn.Spawn} and {@link @tapjs/core!worker.Worker},
* which have special behaviors that are required when a process hangs
* indefinitely.
*/

@@ -321,0 +352,0 @@ endAll(sub?: boolean): void;

@@ -27,3 +27,4 @@ import * as stack from '@tapjs/stack';

/**
* The TestBase class is the parent class of {@link Test}, and passed
* The TestBase class is the parent class of {@link @tapjs/test!index.Test},
* and passed
* to all plugins at instantiation time.

@@ -45,9 +46,36 @@ *

donePromise;
/**
* The number of subtests to run in parallel, if allowed
*/
jobs;
/**
* Array of all subtests that have been added/scheduled,
* and have not yet completed.
*/
subtests = [];
/**
* The pool of parallel tests currently in process
*/
pool = new Set();
/**
* Queue of items awaiting processing. Can be any
* {@link @tapjs/core!test-base.QueueEntry} item.
*/
queue = [VERSION];
/**
* Function that will get this test as an argument when it is processed
*/
cb;
/**
* The count of all assertions this test has seen
*/
count = 0;
/**
* Set true when {@link @tapjs/core!test-base.TestBase#end} is called
*/
ended = false;
/**
* Show diagnostics for this test. A value of `null` means that
* diagnostics will be shown only if the test is failing.
*/
diagnostic = null;

@@ -71,3 +99,3 @@ #planEnd = -1;

/**
* Subtests that are currently in process
* Subtests that are currently in process.
*/

@@ -674,3 +702,2 @@ activeSubtests = new Set();

this.debug('%s.#onBufferedEnd', this.name, p.name, p.results.bailout);
this.pool.delete(p);
p.options.tapChildBuffer = p.output || '';

@@ -682,2 +709,3 @@ p.options.stack = '';

this.#occupied = null;
this.pool.delete(p);
this.activeSubtests.delete(p);

@@ -1024,5 +1052,6 @@ p.deferred?.resolve(p.results);

*
* No need to ever call this directly, exposed so that it can be extended
* by {@link Spawn} and {@link Worker}, which have special behaviors
* that are required when a process hangs indefinitely.
* No need to ever call this directly, exposed so that it can be extended by
* {@link @tapjs/core!spawn.Spawn} and {@link @tapjs/core!worker.Worker},
* which have special behaviors that are required when a process hangs
* indefinitely.
*/

@@ -1029,0 +1058,0 @@ endAll(sub = false) {

import { Extra } from './index.js';
/**
* Very simple result object, just indicating pass/fail status,
* message, and the {@link Extra} object provided to the assertion method.
* message, and the {@link @tapjs/core!index.Extra} object provided to the
* assertion method.
*/

@@ -6,0 +7,0 @@ export interface Result {

/**
* Basically a fancy Deferred, wrapped around an existing promise, used by
* the {@link TestBase#waitOn | t.waitOn} method, and tracked in the
* {@link TestBase#queue}.
* the {@link @tapjs/core!test-base.TestBase#waitOn} method, and
* tracked in the {@link @tapjs/core!test-base.TestBase#queue}.
*

@@ -52,3 +52,3 @@ * The callback function is called when it's been either resolved or

* Called when the waiter is ready, and processed by its owning
* {@link TestBase}
* {@link @tapjs/core!test-base.TestBase}
*/

@@ -55,0 +55,0 @@ finish(): void;

/**
* Basically a fancy Deferred, wrapped around an existing promise, used by
* the {@link TestBase#waitOn | t.waitOn} method, and tracked in the
* {@link TestBase#queue}.
* the {@link @tapjs/core!test-base.TestBase#waitOn} method, and
* tracked in the {@link @tapjs/core!test-base.TestBase#queue}.
*

@@ -96,3 +96,3 @@ * The callback function is called when it's been either resolved or

* Called when the waiter is ready, and processed by its owning
* {@link TestBase}
* {@link @tapjs/core!test-base.TestBase}
*/

@@ -99,0 +99,0 @@ finish() {

@@ -9,3 +9,3 @@ /// <reference types="node" resolution-mode="require"/>

/**
* Events emitted by {@link Worker} instances
* Events emitted by {@link @tapjs/core!worker.Worker} instances
*/

@@ -16,8 +16,8 @@ export interface WorkerEvents extends TapBaseEvents {

/**
* Options that can be provided to a {@link Worker}
* Options that can be provided to a {@link @tapjs/core!worker.Worker}
*/
export interface WorkerOpts extends TestBaseOpts {
/**
* Data that will be available on `t.workerData` on the root {@link TAP}
* object in the worker thread.
* Data that will be available on `t.workerData` on the root
* {@link @tapjs/core!tap.TAP} object in the worker thread.
*/

@@ -24,0 +24,0 @@ workerData?: any;

{
"name": "@tapjs/core",
"version": "0.0.0-11",
"version": "0.0.0-12",
"description": "pluggable core of node-tap",

@@ -50,11 +50,11 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",

"@tapjs/processinfo": "^2.5.6",
"@tapjs/stack": "0.0.0-3",
"@tapjs/test": "0.0.0-11",
"@tapjs/stack": "0.0.0-4",
"@tapjs/test": "0.0.0-12",
"async-hook-domain": "^4.0.1",
"is-actual-promise": "^1.0.0",
"jackspeak": "^2.2.3",
"minipass": "^7.0.2",
"minipass": "^7.0.3",
"signal-exit": "4.1",
"tap-parser": "15.0.0-1",
"tcompare": "6.0.1-2",
"tap-parser": "15.0.0-2",
"tcompare": "6.0.1-3",
"trivial-deferred": "^2.0.0"

@@ -61,0 +61,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

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

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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc