Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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-19 to 0.0.0-20

1

dist/cjs/spawn.js

@@ -93,2 +93,3 @@ "use strict";

});
this.env.TAP_JOB_ID = String(this.options.jobId || 0);
const options = {

@@ -95,0 +96,0 @@ cwd: this.cwd,

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

constructor(options: TapFileOpts);
static getName(name?: string, filename?: string, cwd?: string): string;
main(cb: () => void): void;

@@ -46,0 +47,0 @@ threw(er: any, extra?: any): import("./index.js").Extra | undefined;

13

dist/cjs/tap-file.js

@@ -22,6 +22,3 @@ "use strict";

const { filename, tapStream, cwd = proc_js_1.cwd } = options;
const name = options.name ||
(filename
? (0, node_path_1.relative)(cwd, filename).replace(/\.tap$/, '')
: 'file input');
const name = TapFile.getName(options.name, filename, cwd);
super({ ...options, name });

@@ -33,2 +30,10 @@ this.filename = filename;

}
static getName(name, filename, cwd = proc_js_1.cwd) {
if (name)
return name;
if (!filename)
return 'file input';
const rel = (0, node_path_1.relative)(cwd, filename);
return (rel.startsWith('..' + node_path_1.sep) ? filename : rel).replace(/\.tap$/, '');
}
main(cb) {

@@ -35,0 +40,0 @@ const { tapStream, filename } = this;

@@ -97,2 +97,7 @@ "use strict";

passes: envFlag('TAP_PASSES'),
// these are always set in our tests.
/* c8 ignore start */
childId: Number(proc_js_1.env.TAP_CHILD_ID) || 0,
jobId: Number(proc_js_1.env.TAP_JOB_ID) || 0,
/* c8 ignore stop */
...opts,

@@ -99,0 +104,0 @@ };

@@ -147,2 +147,3 @@ "use strict";

#calledOnEOF = false;
#jobIds;
/**

@@ -196,2 +197,3 @@ * Subtests that are currently in process.

}
this.#jobIds = new Set();
}

@@ -713,2 +715,6 @@ #setCB(cb) {

else {
// ts doesn't know this will always be set at this point
/* c8 ignore start */
p.options.jobId = this.#getJobId(p.options.childId || 0);
/* c8 ignore stop */
p.runMain(() => this.#onBufferedEnd(p));

@@ -733,2 +739,17 @@ }

}
// virtual "worker" id, even though it's just a pool
#getJobId(childId = 0) {
let j = childId % this.jobs;
const start = j;
while (this.#jobIds.has(j)) {
j = (j + 1) % this.jobs;
// impossible because math
/* c8 ignore start */
if (j === start)
return 0;
/* c8 ignore stop */
}
this.#jobIds.add(j);
return j;
}
/**

@@ -747,2 +768,3 @@ * True if the test is currently in an idle state

#onBufferedEnd(p) {
this.#jobIds.delete(p.options.jobId || 0);
p.results = p.results || new tap_parser_1.FinalResults(true, p.parser);

@@ -971,3 +993,12 @@ p.readyToProcess = true;

if (this.results || this.ended) {
const er = new Error('cannot create subtest after parent test ends');
const msg = this.#explicitEnded
? 'subtest after parent test end()'
: this.#explicitPlan
? 'test count exceeds plan'
: this.#promiseEnded
? 'cannot create subtest after parent promise resolves'
: /* c8 ignore start */
'cannot create subtest after parent test ends';
/* c8 ignore stop */
const er = new Error(msg);
Error.captureStackTrace(er, caller);

@@ -974,0 +1005,0 @@ this.threw(er);

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

});
this.env.TAP_JOB_ID = String(this.options.jobId || 0);
const options = {

@@ -92,0 +93,0 @@ cwd: this.cwd,

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

constructor(options: TapFileOpts);
static getName(name?: string, filename?: string, cwd?: string): string;
main(cb: () => void): void;

@@ -46,0 +47,0 @@ threw(er: any, extra?: any): import("./index.js").Extra | undefined;

import { createReadStream } from 'node:fs';
import { relative } from 'node:path';
import { relative, sep } from 'node:path';
import { Base } from './base.js';

@@ -19,6 +19,3 @@ import { cwd as procCwd } from './proc.js';

const { filename, tapStream, cwd = procCwd } = options;
const name = options.name ||
(filename
? relative(cwd, filename).replace(/\.tap$/, '')
: 'file input');
const name = TapFile.getName(options.name, filename, cwd);
super({ ...options, name });

@@ -30,2 +27,10 @@ this.filename = filename;

}
static getName(name, filename, cwd = procCwd) {
if (name)
return name;
if (!filename)
return 'file input';
const rel = relative(cwd, filename);
return (rel.startsWith('..' + sep) ? filename : rel).replace(/\.tap$/, '');
}
main(cb) {

@@ -32,0 +37,0 @@ const { tapStream, filename } = this;

@@ -94,2 +94,7 @@ /**

passes: envFlag('TAP_PASSES'),
// these are always set in our tests.
/* c8 ignore start */
childId: Number(env.TAP_CHILD_ID) || 0,
jobId: Number(env.TAP_JOB_ID) || 0,
/* c8 ignore stop */
...opts,

@@ -96,0 +101,0 @@ };

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

#calledOnEOF = false;
#jobIds;
/**

@@ -167,2 +168,3 @@ * Subtests that are currently in process.

}
this.#jobIds = new Set();
}

@@ -684,2 +686,6 @@ #setCB(cb) {

else {
// ts doesn't know this will always be set at this point
/* c8 ignore start */
p.options.jobId = this.#getJobId(p.options.childId || 0);
/* c8 ignore stop */
p.runMain(() => this.#onBufferedEnd(p));

@@ -704,2 +710,17 @@ }

}
// virtual "worker" id, even though it's just a pool
#getJobId(childId = 0) {
let j = childId % this.jobs;
const start = j;
while (this.#jobIds.has(j)) {
j = (j + 1) % this.jobs;
// impossible because math
/* c8 ignore start */
if (j === start)
return 0;
/* c8 ignore stop */
}
this.#jobIds.add(j);
return j;
}
/**

@@ -718,2 +739,3 @@ * True if the test is currently in an idle state

#onBufferedEnd(p) {
this.#jobIds.delete(p.options.jobId || 0);
p.results = p.results || new FinalResults(true, p.parser);

@@ -942,3 +964,12 @@ p.readyToProcess = true;

if (this.results || this.ended) {
const er = new Error('cannot create subtest after parent test ends');
const msg = this.#explicitEnded
? 'subtest after parent test end()'
: this.#explicitPlan
? 'test count exceeds plan'
: this.#promiseEnded
? 'cannot create subtest after parent promise resolves'
: /* c8 ignore start */
'cannot create subtest after parent test ends';
/* c8 ignore stop */
const er = new Error(msg);
Error.captureStackTrace(er, caller);

@@ -945,0 +976,0 @@ this.threw(er);

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

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

"@tapjs/stack": "0.0.0-6",
"@tapjs/test": "0.0.0-19",
"@tapjs/test": "0.0.0-20",
"async-hook-domain": "^4.0.1",
"is-actual-promise": "^1.0.0",
"jackspeak": "^2.3.1",
"jackspeak": "^2.3.3",
"minipass": "^7.0.3",

@@ -57,0 +57,0 @@ "signal-exit": "4.1",

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