@tapjs/core
Advanced tools
Comparing version
@@ -8,3 +8,3 @@ /** | ||
import { CallSiteLike, CallSiteLikeJSON } from '@tapjs/stack'; | ||
export * from '#tap-dir'; | ||
export * from './tap-file.js'; | ||
export * from './base.js'; | ||
@@ -21,3 +21,3 @@ export * from './counts.js'; | ||
export * from './stdin.js'; | ||
export * from './tap-file.js'; | ||
export * from './tap-dir.js'; | ||
export * from './test-base.js'; | ||
@@ -24,0 +24,0 @@ export * from './test-point.js'; |
@@ -24,3 +24,3 @@ "use strict"; | ||
exports.tap = void 0; | ||
__exportStar(require("#tap-dir"), exports); | ||
__exportStar(require("./tap-file.js"), exports); | ||
__exportStar(require("./base.js"), exports); | ||
@@ -37,3 +37,3 @@ __exportStar(require("./counts.js"), exports); | ||
__exportStar(require("./stdin.js"), exports); | ||
__exportStar(require("./tap-file.js"), exports); | ||
__exportStar(require("./tap-dir.js"), exports); | ||
__exportStar(require("./test-base.js"), exports); | ||
@@ -40,0 +40,0 @@ __exportStar(require("./test-point.js"), exports); |
{ | ||
"type": "commonjs", | ||
"imports": { | ||
"#tap-dir": "./tap-dir-cjs.js" | ||
} | ||
"type": "commonjs" | ||
} |
@@ -139,3 +139,4 @@ "use strict"; | ||
#occupied = null; | ||
#pushedEnd = false; | ||
// set to true if the end should be explicit | ||
#awaitingEnd = false; | ||
#pushedBeforeEnd = false; | ||
@@ -231,3 +232,3 @@ #nextChildId = 1; | ||
const message = ('# ' + body.split(/\r?\n/).join('\n# ')).trim() + '\n'; | ||
if (this.results || this.ended || this.#pushedEnd) { | ||
if (this.results || this.ended || this.#awaitingEnd) { | ||
// the fallback to console.log is a bit weird, | ||
@@ -238,3 +239,3 @@ // but the only alternative seems to be to just lose it. | ||
} | ||
else if (this.writable && !this.#pushedEnd) { | ||
else if (this.writable && !this.#awaitingEnd) { | ||
super.write(message); | ||
@@ -433,3 +434,3 @@ this.parser.emit('comment', message.trim()); | ||
this.#occupied instanceof waiter_js_1.Waiter && | ||
this.#pushedEnd) { | ||
this.#awaitingEnd) { | ||
front = true; | ||
@@ -551,6 +552,3 @@ } | ||
this.debug('#end: queue not empty, or occupied'); | ||
if (!this.#pushedEnd) { | ||
this.queue.push(['#end', implicit]); | ||
} | ||
this.#pushedEnd = true; | ||
this.#awaitingEnd = implicit === implicit_end_sigil_js_1.IMPLICIT ? implicit_end_sigil_js_1.IMPLICIT : true; | ||
return this.#process(); | ||
@@ -675,3 +673,3 @@ } | ||
const m = p.shift(); | ||
const fn = (m === '#end' ? this.#end : this[m]); | ||
const fn = this[m]; | ||
if (typeof fn !== 'function') { | ||
@@ -728,2 +726,5 @@ this.debug(' > weird method not found in queue??', m, typeof this[m]); | ||
else if (this.idle) { | ||
if (this.#awaitingEnd) { | ||
this.#end(this.#awaitingEnd === implicit_end_sigil_js_1.IMPLICIT ? implicit_end_sigil_js_1.IMPLICIT : undefined); | ||
} | ||
// the root tap runner uses this event to know when it is safe to | ||
@@ -747,3 +748,2 @@ // automatically end. | ||
#onBufferedEnd(p) { | ||
p.ondone = p.constructor.prototype.ondone; | ||
p.results = p.results || new tap_parser_1.FinalResults(true, p.parser); | ||
@@ -777,3 +777,2 @@ p.readyToProcess = true; | ||
this.emit('subtestProcess', p); | ||
p.ondone = p.constructor.prototype.ondone; | ||
// we'll generally already have a results by now, but just to be sure | ||
@@ -834,3 +833,6 @@ /* c8 ignore start */ | ||
else | ||
this.ondone = () => cb(); | ||
this.ondone = () => { | ||
super.ondone(); | ||
cb(); | ||
}; | ||
}; | ||
@@ -881,6 +883,3 @@ // This bit of overly clever line-noise wraps the call to user-code | ||
this.debug('calling runMain', p.name); | ||
p.runMain(() => { | ||
this.debug('runMain callback', p.name); | ||
this.#onIndentedEnd(p); | ||
}); | ||
p.runMain(() => this.#onIndentedEnd(p)); | ||
} | ||
@@ -1095,5 +1094,5 @@ else if (p.readyToProcess) { | ||
this.fail(msg, extra); | ||
if (this.ended || this.#pushedEnd) { | ||
if (this.ended || this.#awaitingEnd) { | ||
this.ended = false; | ||
this.#pushedEnd = false; | ||
this.#awaitingEnd = false; | ||
this.end(implicit_end_sigil_js_1.IMPLICIT); | ||
@@ -1100,0 +1099,0 @@ } |
@@ -8,3 +8,3 @@ /** | ||
import { CallSiteLike, CallSiteLikeJSON } from '@tapjs/stack'; | ||
export * from '#tap-dir'; | ||
export * from './tap-file.js'; | ||
export * from './base.js'; | ||
@@ -21,3 +21,3 @@ export * from './counts.js'; | ||
export * from './stdin.js'; | ||
export * from './tap-file.js'; | ||
export * from './tap-dir.js'; | ||
export * from './test-base.js'; | ||
@@ -24,0 +24,0 @@ export * from './test-point.js'; |
@@ -7,3 +7,3 @@ /** | ||
*/ | ||
export * from '#tap-dir'; | ||
export * from './tap-file.js'; | ||
export * from './base.js'; | ||
@@ -20,3 +20,3 @@ export * from './counts.js'; | ||
export * from './stdin.js'; | ||
export * from './tap-file.js'; | ||
export * from './tap-dir.js'; | ||
export * from './test-base.js'; | ||
@@ -23,0 +23,0 @@ export * from './test-point.js'; |
{ | ||
"type": "module", | ||
"imports": { | ||
"#tap-dir": "./tap-dir.js" | ||
} | ||
"type": "module" | ||
} |
@@ -110,3 +110,4 @@ import * as stack from '@tapjs/stack'; | ||
#occupied = null; | ||
#pushedEnd = false; | ||
// set to true if the end should be explicit | ||
#awaitingEnd = false; | ||
#pushedBeforeEnd = false; | ||
@@ -202,3 +203,3 @@ #nextChildId = 1; | ||
const message = ('# ' + body.split(/\r?\n/).join('\n# ')).trim() + '\n'; | ||
if (this.results || this.ended || this.#pushedEnd) { | ||
if (this.results || this.ended || this.#awaitingEnd) { | ||
// the fallback to console.log is a bit weird, | ||
@@ -209,3 +210,3 @@ // but the only alternative seems to be to just lose it. | ||
} | ||
else if (this.writable && !this.#pushedEnd) { | ||
else if (this.writable && !this.#awaitingEnd) { | ||
super.write(message); | ||
@@ -404,3 +405,3 @@ this.parser.emit('comment', message.trim()); | ||
this.#occupied instanceof Waiter && | ||
this.#pushedEnd) { | ||
this.#awaitingEnd) { | ||
front = true; | ||
@@ -522,6 +523,3 @@ } | ||
this.debug('#end: queue not empty, or occupied'); | ||
if (!this.#pushedEnd) { | ||
this.queue.push(['#end', implicit]); | ||
} | ||
this.#pushedEnd = true; | ||
this.#awaitingEnd = implicit === IMPLICIT ? IMPLICIT : true; | ||
return this.#process(); | ||
@@ -646,3 +644,3 @@ } | ||
const m = p.shift(); | ||
const fn = (m === '#end' ? this.#end : this[m]); | ||
const fn = this[m]; | ||
if (typeof fn !== 'function') { | ||
@@ -699,2 +697,5 @@ this.debug(' > weird method not found in queue??', m, typeof this[m]); | ||
else if (this.idle) { | ||
if (this.#awaitingEnd) { | ||
this.#end(this.#awaitingEnd === IMPLICIT ? IMPLICIT : undefined); | ||
} | ||
// the root tap runner uses this event to know when it is safe to | ||
@@ -718,3 +719,2 @@ // automatically end. | ||
#onBufferedEnd(p) { | ||
p.ondone = p.constructor.prototype.ondone; | ||
p.results = p.results || new FinalResults(true, p.parser); | ||
@@ -748,3 +748,2 @@ p.readyToProcess = true; | ||
this.emit('subtestProcess', p); | ||
p.ondone = p.constructor.prototype.ondone; | ||
// we'll generally already have a results by now, but just to be sure | ||
@@ -805,3 +804,6 @@ /* c8 ignore start */ | ||
else | ||
this.ondone = () => cb(); | ||
this.ondone = () => { | ||
super.ondone(); | ||
cb(); | ||
}; | ||
}; | ||
@@ -852,6 +854,3 @@ // This bit of overly clever line-noise wraps the call to user-code | ||
this.debug('calling runMain', p.name); | ||
p.runMain(() => { | ||
this.debug('runMain callback', p.name); | ||
this.#onIndentedEnd(p); | ||
}); | ||
p.runMain(() => this.#onIndentedEnd(p)); | ||
} | ||
@@ -1066,5 +1065,5 @@ else if (p.readyToProcess) { | ||
this.fail(msg, extra); | ||
if (this.ended || this.#pushedEnd) { | ||
if (this.ended || this.#awaitingEnd) { | ||
this.ended = false; | ||
this.#pushedEnd = false; | ||
this.#awaitingEnd = false; | ||
this.end(IMPLICIT); | ||
@@ -1071,0 +1070,0 @@ } |
{ | ||
"name": "@tapjs/core", | ||
"version": "0.0.0-16", | ||
"version": "0.0.0-17", | ||
"description": "pluggable core of node-tap", | ||
@@ -33,14 +33,2 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
}, | ||
"imports": { | ||
"#tap-dir": { | ||
"import": { | ||
"types": "./dist/mjs/tap-dir.d.ts", | ||
"default": "./dist/mjs/tap-dir.js" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/tap-dir-cjs.d.ts", | ||
"default": "./dist/cjs/tap-dir-cjs.js" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
@@ -63,4 +51,4 @@ "dist" | ||
"@tapjs/processinfo": "^2.5.6", | ||
"@tapjs/stack": "0.0.0-5", | ||
"@tapjs/test": "0.0.0-16", | ||
"@tapjs/stack": "0.0.0-6", | ||
"@tapjs/test": "0.0.0-17", | ||
"async-hook-domain": "^4.0.1", | ||
@@ -67,0 +55,0 @@ "is-actual-promise": "^1.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
792510
0.14%209
1.95%9954
0.13%+ Added
+ Added
- Removed
- Removed
Updated
Updated