@tapjs/core
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -396,2 +396,7 @@ /** | ||
/** | ||
* Boolean indicating whether the underlying stream can be written to, | ||
* or if it has been ended. | ||
*/ | ||
get streamWritable(): boolean; | ||
/** | ||
* The main test function. For this Base class, this is a no-op. Subclasses | ||
@@ -398,0 +403,0 @@ * implement this in their specific ways. |
@@ -220,2 +220,3 @@ "use strict"; | ||
#printedOutput = false; | ||
#writable = true; | ||
constructor(options = {}) { | ||
@@ -416,2 +417,7 @@ super({ encoding: 'utf8' }); | ||
/** | ||
* Boolean indicating whether the underlying stream can be written to, | ||
* or if it has been ended. | ||
*/ | ||
get streamWritable() { return this.#writable; } | ||
/** | ||
* The main test function. For this Base class, this is a no-op. Subclasses | ||
@@ -449,2 +455,5 @@ * implement this in their specific ways. | ||
} | ||
if (!this.#writable) { | ||
return false; | ||
} | ||
return super.write(c); | ||
@@ -507,2 +516,3 @@ } | ||
} | ||
this.#writable = false; | ||
super.end(); | ||
@@ -509,0 +519,0 @@ } |
@@ -131,3 +131,6 @@ "use strict"; | ||
#planEnd = -1; | ||
#planAt; | ||
#printedResult = false; | ||
#endingAll = false; | ||
#endingAllSub = false; | ||
#explicitEnded = false; | ||
@@ -237,9 +240,9 @@ #explicitPlan = false; | ||
// but the only alternative seems to be to just lose it. | ||
if (this.parent) { | ||
this.parent.comment(...args); | ||
} | ||
else if (this.writable && !this.#awaitingEnd) { | ||
if (this.streamWritable) { | ||
super.write(message); | ||
this.parser.emit('comment', message.trim()); | ||
} | ||
else if (this.parent) { | ||
this.parent.comment(...args); | ||
} | ||
else { | ||
@@ -292,2 +295,5 @@ console.log(message.trimEnd()); | ||
this.#explicitPlan = implicit !== implicit_end_sigil_js_1.IMPLICIT; | ||
if (this.#explicitPlan) { | ||
this.#planAt = stack.at(this.plan); | ||
} | ||
if (this.#planEnd !== -1) { | ||
@@ -580,3 +586,5 @@ throw new Error('Cannot set plan after test has ended'); | ||
this.debug('#end: queue not empty, or occupied'); | ||
this.#awaitingEnd = implicit === implicit_end_sigil_js_1.IMPLICIT ? implicit_end_sigil_js_1.IMPLICIT : true; | ||
if (!this.#awaitingEnd) { | ||
this.#awaitingEnd = implicit === implicit_end_sigil_js_1.IMPLICIT ? implicit_end_sigil_js_1.IMPLICIT : true; | ||
} | ||
return this.#process(); | ||
@@ -600,4 +608,2 @@ } | ||
} | ||
this.debug('set ended=true'); | ||
this.ended = true; | ||
if (this.#planEnd === -1 && !this.#doingStdinOnly) { | ||
@@ -608,2 +614,15 @@ this.debug('END(%s) implicit plan', this.name, this.count); | ||
} | ||
else if (!this.ended && this.#planEnd !== -1) { | ||
const count = this.#endingAllSub ? this.count - 1 : this.count; | ||
if (this.#planEnd > count) { | ||
this.fail(`test count(${count}) != plan(${this.#planEnd})`, { | ||
found: count, | ||
wanted: this.#planEnd, | ||
at: this.#planAt, | ||
stack: '', | ||
}); | ||
} | ||
} | ||
this.debug('set ended=true'); | ||
this.ended = true; | ||
this.queue.push(EOF); | ||
@@ -798,2 +817,5 @@ this.#process(); | ||
#onBufferedEnd(p) { | ||
// ignore ends that come in after we've already aborted | ||
if (this.ended && this.#endingAll) | ||
return; | ||
this.#jobIds.delete(p.options.jobId || 0); | ||
@@ -826,2 +848,5 @@ p.results = p.results || new tap_parser_1.FinalResults(true, p.parser); | ||
#onIndentedEnd(p) { | ||
// ignore ends that come in after we've already aborted | ||
if (this.ended && this.#endingAll) | ||
return; | ||
this.debug('onIndentedEnd', p.name); | ||
@@ -1215,2 +1240,4 @@ this.emit('subtestProcess', p); | ||
return; | ||
this.#endingAll = true; | ||
this.#endingAllSub = sub; | ||
// in the case of the root TAP test object, we might sometimes | ||
@@ -1225,4 +1252,7 @@ // call endAll on a bailing-out test, as the process is ending | ||
p.abort(new Error('test unfinished')); | ||
else if (typeof p.endAll === 'function') | ||
p.endAll(true); | ||
else if (typeof p.endAll === 'function') { | ||
// first try to end explicitly, then endAll if that didn't work | ||
const pt = p; | ||
pt.endAll(true); | ||
} | ||
else | ||
@@ -1252,3 +1282,5 @@ p.parser.abort('test unfinished'); | ||
this.#processing = false; | ||
this.#end(implicit_end_sigil_js_1.IMPLICIT); | ||
this.#process(); | ||
this.end(implicit_end_sigil_js_1.IMPLICIT); | ||
this.#process(); | ||
} | ||
@@ -1255,0 +1287,0 @@ /** |
@@ -396,2 +396,7 @@ /** | ||
/** | ||
* Boolean indicating whether the underlying stream can be written to, | ||
* or if it has been ended. | ||
*/ | ||
get streamWritable(): boolean; | ||
/** | ||
* The main test function. For this Base class, this is a no-op. Subclasses | ||
@@ -398,0 +403,0 @@ * implement this in their specific ways. |
@@ -216,2 +216,3 @@ /** | ||
#printedOutput = false; | ||
#writable = true; | ||
constructor(options = {}) { | ||
@@ -412,2 +413,7 @@ super({ encoding: 'utf8' }); | ||
/** | ||
* Boolean indicating whether the underlying stream can be written to, | ||
* or if it has been ended. | ||
*/ | ||
get streamWritable() { return this.#writable; } | ||
/** | ||
* The main test function. For this Base class, this is a no-op. Subclasses | ||
@@ -445,2 +451,5 @@ * implement this in their specific ways. | ||
} | ||
if (!this.#writable) { | ||
return false; | ||
} | ||
return super.write(c); | ||
@@ -503,2 +512,3 @@ } | ||
} | ||
this.#writable = false; | ||
super.end(); | ||
@@ -505,0 +515,0 @@ } |
@@ -102,3 +102,6 @@ import * as stack from '@tapjs/stack'; | ||
#planEnd = -1; | ||
#planAt; | ||
#printedResult = false; | ||
#endingAll = false; | ||
#endingAllSub = false; | ||
#explicitEnded = false; | ||
@@ -208,9 +211,9 @@ #explicitPlan = false; | ||
// but the only alternative seems to be to just lose it. | ||
if (this.parent) { | ||
this.parent.comment(...args); | ||
} | ||
else if (this.writable && !this.#awaitingEnd) { | ||
if (this.streamWritable) { | ||
super.write(message); | ||
this.parser.emit('comment', message.trim()); | ||
} | ||
else if (this.parent) { | ||
this.parent.comment(...args); | ||
} | ||
else { | ||
@@ -263,2 +266,5 @@ console.log(message.trimEnd()); | ||
this.#explicitPlan = implicit !== IMPLICIT; | ||
if (this.#explicitPlan) { | ||
this.#planAt = stack.at(this.plan); | ||
} | ||
if (this.#planEnd !== -1) { | ||
@@ -551,3 +557,5 @@ throw new Error('Cannot set plan after test has ended'); | ||
this.debug('#end: queue not empty, or occupied'); | ||
this.#awaitingEnd = implicit === IMPLICIT ? IMPLICIT : true; | ||
if (!this.#awaitingEnd) { | ||
this.#awaitingEnd = implicit === IMPLICIT ? IMPLICIT : true; | ||
} | ||
return this.#process(); | ||
@@ -571,4 +579,2 @@ } | ||
} | ||
this.debug('set ended=true'); | ||
this.ended = true; | ||
if (this.#planEnd === -1 && !this.#doingStdinOnly) { | ||
@@ -579,2 +585,15 @@ this.debug('END(%s) implicit plan', this.name, this.count); | ||
} | ||
else if (!this.ended && this.#planEnd !== -1) { | ||
const count = this.#endingAllSub ? this.count - 1 : this.count; | ||
if (this.#planEnd > count) { | ||
this.fail(`test count(${count}) != plan(${this.#planEnd})`, { | ||
found: count, | ||
wanted: this.#planEnd, | ||
at: this.#planAt, | ||
stack: '', | ||
}); | ||
} | ||
} | ||
this.debug('set ended=true'); | ||
this.ended = true; | ||
this.queue.push(EOF); | ||
@@ -769,2 +788,5 @@ this.#process(); | ||
#onBufferedEnd(p) { | ||
// ignore ends that come in after we've already aborted | ||
if (this.ended && this.#endingAll) | ||
return; | ||
this.#jobIds.delete(p.options.jobId || 0); | ||
@@ -797,2 +819,5 @@ p.results = p.results || new FinalResults(true, p.parser); | ||
#onIndentedEnd(p) { | ||
// ignore ends that come in after we've already aborted | ||
if (this.ended && this.#endingAll) | ||
return; | ||
this.debug('onIndentedEnd', p.name); | ||
@@ -1186,2 +1211,4 @@ this.emit('subtestProcess', p); | ||
return; | ||
this.#endingAll = true; | ||
this.#endingAllSub = sub; | ||
// in the case of the root TAP test object, we might sometimes | ||
@@ -1196,4 +1223,7 @@ // call endAll on a bailing-out test, as the process is ending | ||
p.abort(new Error('test unfinished')); | ||
else if (typeof p.endAll === 'function') | ||
p.endAll(true); | ||
else if (typeof p.endAll === 'function') { | ||
// first try to end explicitly, then endAll if that didn't work | ||
const pt = p; | ||
pt.endAll(true); | ||
} | ||
else | ||
@@ -1223,3 +1253,5 @@ p.parser.abort('test unfinished'); | ||
this.#processing = false; | ||
this.#end(IMPLICIT); | ||
this.#process(); | ||
this.end(IMPLICIT); | ||
this.#process(); | ||
} | ||
@@ -1226,0 +1258,0 @@ /** |
{ | ||
"name": "@tapjs/core", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "pluggable core of node-tap", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
"type": "module", | ||
"tshy": { | ||
"main": true, | ||
"exports": { | ||
@@ -14,2 +13,5 @@ "./package.json": "./package.json", | ||
}, | ||
"type": "module", | ||
"main": "./dist/commonjs/index.js", | ||
"types": "./dist/commonjs/index.d.ts", | ||
"exports": { | ||
@@ -50,19 +52,20 @@ "./package.json": "./package.json", | ||
}, | ||
"tap": { | ||
"coverage-map": "map.js" | ||
}, | ||
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
"license": "BlueOak-1.0.0", | ||
"dependencies": { | ||
"@tapjs/processinfo": "^3.1.1", | ||
"@tapjs/stack": "1.1.0", | ||
"@tapjs/test": "1.2.0", | ||
"@tapjs/processinfo": "^3.1.2", | ||
"@tapjs/stack": "1.2.0", | ||
"@tapjs/test": "1.3.0", | ||
"async-hook-domain": "^4.0.1", | ||
"is-actual-promise": "^1.0.0", | ||
"jackspeak": "^2.3.4", | ||
"jackspeak": "^2.3.6", | ||
"minipass": "^7.0.3", | ||
"signal-exit": "4.1", | ||
"tap-parser": "15.1.0", | ||
"tcompare": "6.1.0", | ||
"tap-parser": "15.2.0", | ||
"tcompare": "6.2.0", | ||
"trivial-deferred": "^2.0.0" | ||
}, | ||
"license": "BlueOak-1.0.0", | ||
"tap": { | ||
"coverage-map": "map.js" | ||
}, | ||
"repository": { | ||
@@ -69,0 +72,0 @@ "type": "git", |
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
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
840115
10433
+ Added@tapjs/after@1.1.0(transitive)
+ Added@tapjs/after-each@1.1.0(transitive)
+ Added@tapjs/asserts@1.1.0(transitive)
+ Added@tapjs/before@1.1.0(transitive)
+ Added@tapjs/before-each@1.1.0(transitive)
+ Added@tapjs/error-serdes@1.1.0(transitive)
+ Added@tapjs/filter@1.2.0(transitive)
+ Added@tapjs/fixture@1.2.0(transitive)
+ Added@tapjs/intercept@1.2.0(transitive)
+ Added@tapjs/mock@1.1.0(transitive)
+ Added@tapjs/node-serialize@1.1.0(transitive)
+ Added@tapjs/snapshot@1.2.0(transitive)
+ Added@tapjs/spawn@1.1.0(transitive)
+ Added@tapjs/stack@1.2.0(transitive)
+ Added@tapjs/stdin@1.1.0(transitive)
+ Added@tapjs/test@1.3.0(transitive)
+ Added@tapjs/typescript@1.2.0(transitive)
+ Added@tapjs/worker@1.1.0(transitive)
+ Added@types/node@22.5.5(transitive)
+ Addedtap-parser@15.2.0(transitive)
+ Addedtap-yaml@2.2.0(transitive)
+ Addedtcompare@6.2.0(transitive)
- Removed@tapjs/after@1.0.7(transitive)
- Removed@tapjs/after-each@1.0.7(transitive)
- Removed@tapjs/asserts@1.0.7(transitive)
- Removed@tapjs/before@1.0.7(transitive)
- Removed@tapjs/before-each@1.0.7(transitive)
- Removed@tapjs/error-serdes@1.0.0(transitive)
- Removed@tapjs/filter@1.1.3(transitive)
- Removed@tapjs/fixture@1.1.0(transitive)
- Removed@tapjs/intercept@1.1.4(transitive)
- Removed@tapjs/mock@1.0.8(transitive)
- Removed@tapjs/node-serialize@1.0.3(transitive)
- Removed@tapjs/snapshot@1.1.0(transitive)
- Removed@tapjs/spawn@1.0.7(transitive)
- Removed@tapjs/stack@1.1.0(transitive)
- Removed@tapjs/stdin@1.0.7(transitive)
- Removed@tapjs/test@1.2.0(transitive)
- Removed@tapjs/typescript@1.1.3(transitive)
- Removed@tapjs/worker@1.0.7(transitive)
- Removed@types/node@22.5.4(transitive)
- Removedtap-parser@15.1.0(transitive)
- Removedtap-yaml@2.1.1(transitive)
- Removedtcompare@6.1.0(transitive)
Updated@tapjs/processinfo@^3.1.2
Updated@tapjs/stack@1.2.0
Updated@tapjs/test@1.3.0
Updatedjackspeak@^2.3.6
Updatedtap-parser@15.2.0
Updatedtcompare@6.2.0