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 1.0.3 to 1.1.0

15

dist/commonjs/base.d.ts

@@ -87,2 +87,10 @@ /**

/**
* treat todo tests as failures, default false
*/
failTodo?: boolean;
/**
* treat skip tests as failures, default false
*/
failSkip?: boolean;
/**
* The amount of time that this test took to complete.

@@ -249,2 +257,9 @@ *

/**
* Nesting level, for serialization to node test runner
*
* Note that this is zero for parent-less tests, and *also* zero
* for the first level of children.
*/
nestingLevel: number;
/**
* Bail out on the first failed test point

@@ -251,0 +266,0 @@ */

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

/**
* Nesting level, for serialization to node test runner
*
* Note that this is zero for parent-less tests, and *also* zero
* for the first level of children.
*/
nestingLevel = 0;
/**
* Bail out on the first failed test point

@@ -248,2 +255,5 @@ */

this.parent = options.parent;
if (this.parent?.parent) {
this.nestingLevel = this.parent.nestingLevel + 1;
}
this.time = 0;

@@ -250,0 +260,0 @@ this.hrtime = 0n;

8

dist/commonjs/clean-yaml-object.js

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

// their own diff, which is much nicer.
if (res.found &&
res.wanted &&
if ('found' in res &&
'wanted' in res &&
res.found !== res.wanted &&

@@ -174,2 +174,5 @@ !res.diff) {

'parent',
// only relevant if activated, a failedTodo or failedSkip will be added
'failSkip',
'failTodo',
// TODO: keys added by plugins, but referenced here

@@ -191,2 +194,3 @@ // How can this list be adjusted by plugins?

'context',
'debug',
// TODO: keys added by plugins, but referenced here

@@ -193,0 +197,0 @@ // How can this list be adjusted by plugins?

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

!signal) {
this.options.skip = this.results.plan.skipReason || true;
this.options.skip = this.results.plan.skipReason || 'no tests found';
}

@@ -162,0 +162,0 @@ if (code || signal) {

@@ -69,2 +69,3 @@ /// <reference types="node" />

constructor(priv: PrivateTAPCtor, opts?: TestOpts);
get registered(): boolean;
/**

@@ -71,0 +72,0 @@ * register this tap instance as being in charge of the current process

@@ -96,2 +96,4 @@ "use strict";

timeout,
failTodo: envFlag('TAP_FAIL_TODO'),
failSkip: envFlag('TAP_FAIL_SKIP'),
passes: envFlag('TAP_PASSES'),

@@ -105,2 +107,3 @@ // these are always set in our tests.

};
// plugins get applied right here:
super(options);

@@ -126,2 +129,5 @@ instance = this;

}
get registered() {
return registered;
}
/**

@@ -128,0 +134,0 @@ * register this tap instance as being in charge of the current process

@@ -200,3 +200,3 @@ /// <reference types="node" />

/**
* The count of all assertions this test has seen
* The count of all assertions made directly on this test.
*

@@ -203,0 +203,0 @@ * @group Test Reflection

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

/**
* The count of all assertions this test has seen
* The count of all assertions made directly on this test.
*

@@ -350,2 +350,18 @@ * @group Test Reflection

}
// apply flags from our options onto an Extra or TestOpts object
#inheritFlags(extra) {
const inheritedFlags = [
'bail',
'debug',
'passes',
'failTodo',
'failSkip',
];
for (const k of inheritedFlags) {
if (extra[k] === undefined &&
typeof this.options[k] === 'boolean') {
extra[k] = this.options[k];
}
}
}
/**

@@ -391,2 +407,22 @@ * Print a Test Point.

}
if (extra.skip && this.options.failSkip) {
extra.failedSkip = extra.skip;
delete extra.skip;
ok = false;
}
if (extra.todo && this.options.failTodo) {
extra.failedTodo = extra.todo;
delete extra.todo;
ok = false;
}
const diagnostic = typeof extra.diagnostic === 'boolean'
? extra.diagnostic
: typeof this.diagnostic === 'boolean'
? this.diagnostic
: extra.skip || extra.todo
? false
: !ok;
if (diagnostic) {
extra.diagnostic = true;
}
if (extra.at === null) {

@@ -414,15 +450,6 @@ delete extra.at;

}
const diagnostic = typeof extra.diagnostic === 'boolean'
? extra.diagnostic
: typeof this.diagnostic === 'boolean'
? this.diagnostic
: extra.skip || extra.todo
? false
: !ok;
if (diagnostic) {
extra.diagnostic = true;
}
this.count = n;
message = message + '';
const res = { ok, message, extra };
this.#inheritFlags(extra);
const tp = new test_point_js_1.TestPoint(ok, message, extra);

@@ -577,3 +604,4 @@ // when we jump the queue, skip an extra line

this.debug('END(%s) implicit plan', this.name, this.count);
this.plan(this.count, '', implicit_end_sigil_js_1.IMPLICIT);
const c = this.count === 0 && !this.parent ? 'no tests found' : '';
this.plan(this.count, c, implicit_end_sigil_js_1.IMPLICIT);
}

@@ -1013,2 +1041,3 @@ this.queue.push(EOF);

if (this.shouldSkipChild(extra)) {
this.currentAssert = this.sub;
this.pass(extra.name || '', extra);

@@ -1023,3 +1052,2 @@ return Object.assign(Promise.resolve(null), {

}
extra.bail ??= this.bail;
extra.parent = this;

@@ -1032,8 +1060,3 @@ if (!extra.at && extra.at !== null) {

extra.context = this.context;
if (this.options.debug)
extra.debug ??= true;
if (extra.passes === undefined &&
this.options.passes !== undefined) {
extra.passes = !!this.options.passes;
}
this.#inheritFlags(extra);
const t = new Class(extra);

@@ -1217,2 +1240,4 @@ this.queue.push(t);

const msg = `child test left in queue: ${p.name}`;
delete p.options.skip;
delete p.options.todo;
this.queue[i] = new test_point_js_1.TestPoint(false, msg, p.options);

@@ -1219,0 +1244,0 @@ this.count++;

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

constructor(ok, message, extra) {
extra = extra || {};
this.ok = ok ? 'ok ' : 'not ok ';
extra = extra || {};
message = message

@@ -47,2 +47,3 @@ .trim()

}
// TODO: add # time if duration_ms in extra
const diagYaml = extra.diagnostic ? '\n' + (0, diags_js_1.diags)(extra) : '';

@@ -49,0 +50,0 @@ message += diagYaml + '\n';

@@ -87,2 +87,10 @@ /**

/**
* treat todo tests as failures, default false
*/
failTodo?: boolean;
/**
* treat skip tests as failures, default false
*/
failSkip?: boolean;
/**
* The amount of time that this test took to complete.

@@ -249,2 +257,9 @@ *

/**
* Nesting level, for serialization to node test runner
*
* Note that this is zero for parent-less tests, and *also* zero
* for the first level of children.
*/
nestingLevel: number;
/**
* Bail out on the first failed test point

@@ -251,0 +266,0 @@ */

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

/**
* Nesting level, for serialization to node test runner
*
* Note that this is zero for parent-less tests, and *also* zero
* for the first level of children.
*/
nestingLevel = 0;
/**
* Bail out on the first failed test point

@@ -244,2 +251,5 @@ */

this.parent = options.parent;
if (this.parent?.parent) {
this.nestingLevel = this.parent.nestingLevel + 1;
}
this.time = 0;

@@ -246,0 +256,0 @@ this.hrtime = 0n;

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

// their own diff, which is much nicer.
if (res.found &&
res.wanted &&
if ('found' in res &&
'wanted' in res &&
res.found !== res.wanted &&

@@ -147,2 +147,5 @@ !res.diff) {

'parent',
// only relevant if activated, a failedTodo or failedSkip will be added
'failSkip',
'failTodo',
// TODO: keys added by plugins, but referenced here

@@ -164,2 +167,3 @@ // How can this list be adjusted by plugins?

'context',
'debug',
// TODO: keys added by plugins, but referenced here

@@ -166,0 +170,0 @@ // How can this list be adjusted by plugins?

@@ -156,3 +156,3 @@ import { Base } from './base.js';

!signal) {
this.options.skip = this.results.plan.skipReason || true;
this.options.skip = this.results.plan.skipReason || 'no tests found';
}

@@ -159,0 +159,0 @@ if (code || signal) {

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

constructor(priv: PrivateTAPCtor, opts?: TestOpts);
get registered(): boolean;
/**

@@ -71,0 +72,0 @@ * register this tap instance as being in charge of the current process

@@ -93,2 +93,4 @@ /**

timeout,
failTodo: envFlag('TAP_FAIL_TODO'),
failSkip: envFlag('TAP_FAIL_SKIP'),
passes: envFlag('TAP_PASSES'),

@@ -102,2 +104,3 @@ // these are always set in our tests.

};
// plugins get applied right here:
super(options);

@@ -123,2 +126,5 @@ instance = this;

}
get registered() {
return registered;
}
/**

@@ -125,0 +131,0 @@ * register this tap instance as being in charge of the current process

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

/**
* The count of all assertions this test has seen
* The count of all assertions made directly on this test.
*

@@ -203,0 +203,0 @@ * @group Test Reflection

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

/**
* The count of all assertions this test has seen
* The count of all assertions made directly on this test.
*

@@ -321,2 +321,18 @@ * @group Test Reflection

}
// apply flags from our options onto an Extra or TestOpts object
#inheritFlags(extra) {
const inheritedFlags = [
'bail',
'debug',
'passes',
'failTodo',
'failSkip',
];
for (const k of inheritedFlags) {
if (extra[k] === undefined &&
typeof this.options[k] === 'boolean') {
extra[k] = this.options[k];
}
}
}
/**

@@ -362,2 +378,22 @@ * Print a Test Point.

}
if (extra.skip && this.options.failSkip) {
extra.failedSkip = extra.skip;
delete extra.skip;
ok = false;
}
if (extra.todo && this.options.failTodo) {
extra.failedTodo = extra.todo;
delete extra.todo;
ok = false;
}
const diagnostic = typeof extra.diagnostic === 'boolean'
? extra.diagnostic
: typeof this.diagnostic === 'boolean'
? this.diagnostic
: extra.skip || extra.todo
? false
: !ok;
if (diagnostic) {
extra.diagnostic = true;
}
if (extra.at === null) {

@@ -385,15 +421,6 @@ delete extra.at;

}
const diagnostic = typeof extra.diagnostic === 'boolean'
? extra.diagnostic
: typeof this.diagnostic === 'boolean'
? this.diagnostic
: extra.skip || extra.todo
? false
: !ok;
if (diagnostic) {
extra.diagnostic = true;
}
this.count = n;
message = message + '';
const res = { ok, message, extra };
this.#inheritFlags(extra);
const tp = new TestPoint(ok, message, extra);

@@ -548,3 +575,4 @@ // when we jump the queue, skip an extra line

this.debug('END(%s) implicit plan', this.name, this.count);
this.plan(this.count, '', IMPLICIT);
const c = this.count === 0 && !this.parent ? 'no tests found' : '';
this.plan(this.count, c, IMPLICIT);
}

@@ -984,2 +1012,3 @@ this.queue.push(EOF);

if (this.shouldSkipChild(extra)) {
this.currentAssert = this.sub;
this.pass(extra.name || '', extra);

@@ -994,3 +1023,2 @@ return Object.assign(Promise.resolve(null), {

}
extra.bail ??= this.bail;
extra.parent = this;

@@ -1003,8 +1031,3 @@ if (!extra.at && extra.at !== null) {

extra.context = this.context;
if (this.options.debug)
extra.debug ??= true;
if (extra.passes === undefined &&
this.options.passes !== undefined) {
extra.passes = !!this.options.passes;
}
this.#inheritFlags(extra);
const t = new Class(extra);

@@ -1188,2 +1211,4 @@ this.queue.push(t);

const msg = `child test left in queue: ${p.name}`;
delete p.options.skip;
delete p.options.todo;
this.queue[i] = new TestPoint(false, msg, p.options);

@@ -1190,0 +1215,0 @@ this.count++;

@@ -13,4 +13,4 @@ import { diags } from './diags.js';

constructor(ok, message, extra) {
extra = extra || {};
this.ok = ok ? 'ok ' : 'not ok ';
extra = extra || {};
message = message

@@ -43,2 +43,3 @@ .trim()

}
// TODO: add # time if duration_ms in extra
const diagYaml = extra.diagnostic ? '\n' + diags(extra) : '';

@@ -45,0 +46,0 @@ message += diagYaml + '\n';

{
"name": "@tapjs/core",
"version": "1.0.3",
"version": "1.1.0",
"description": "pluggable core of node-tap",

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

"@tapjs/processinfo": "^3.1.1",
"@tapjs/stack": "1.0.0",
"@tapjs/test": "1.0.3",
"@tapjs/stack": "1.1.0",
"@tapjs/test": "1.1.0",
"async-hook-domain": "^4.0.1",

@@ -62,3 +62,3 @@ "is-actual-promise": "^1.0.0",

"signal-exit": "4.1",
"tap-parser": "15.0.0",
"tap-parser": "15.1.0",
"tcompare": "6.1.0",

@@ -65,0 +65,0 @@ "trivial-deferred": "^2.0.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

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