@tapjs/core
Advanced tools
Comparing version 1.4.6 to 1.5.0
@@ -132,2 +132,10 @@ /** | ||
* tests using `Object.create()`. | ||
* | ||
* If not set in the options, this is initialized to a null-prototyped | ||
* object, so that usage like `t.context.foo = 'bar'` will work as expected. | ||
* | ||
* This is initialized and set on the Test object in the `runMain` method, | ||
* *not* at construction time. If set explicitly on the Test object in a | ||
* `before` hook, then any context specified on options or inherited from | ||
* the parent test will be ignored. | ||
*/ | ||
@@ -134,0 +142,0 @@ context?: any; |
@@ -236,11 +236,2 @@ "use strict"; | ||
this.silent = !!options.silent; | ||
// if it's null or an object, inherit from it. otherwise, copy it. | ||
const ctx = options.context; | ||
if (ctx !== undefined) { | ||
this.context = | ||
typeof ctx === 'object' ? Object.create(ctx) : ctx; | ||
} | ||
else { | ||
this.context = null; | ||
} | ||
this.bail = !!options.bail; | ||
@@ -404,2 +395,9 @@ this.strict = !!options.strict; | ||
this.#started = true; | ||
// if it's null or an object, inherit from it. otherwise, copy it. | ||
const ctx = this.context ?? | ||
('context' in this.options | ||
? this.options.context | ||
: this.parent?.context) ?? | ||
null; | ||
this.context = typeof ctx === 'object' ? Object.create(ctx) : ctx; | ||
this.hook.runInAsyncScope(this.main, this, cb); | ||
@@ -406,0 +404,0 @@ } |
@@ -357,2 +357,3 @@ "use strict"; | ||
'failSkip', | ||
'diagnostic', | ||
]; | ||
@@ -1104,3 +1105,2 @@ for (const k of inheritedFlags) { | ||
} | ||
extra.context = this.context; | ||
this.#inheritFlags(extra); | ||
@@ -1107,0 +1107,0 @@ const t = new Class(extra); |
@@ -132,2 +132,10 @@ /** | ||
* tests using `Object.create()`. | ||
* | ||
* If not set in the options, this is initialized to a null-prototyped | ||
* object, so that usage like `t.context.foo = 'bar'` will work as expected. | ||
* | ||
* This is initialized and set on the Test object in the `runMain` method, | ||
* *not* at construction time. If set explicitly on the Test object in a | ||
* `before` hook, then any context specified on options or inherited from | ||
* the parent test will be ignored. | ||
*/ | ||
@@ -134,0 +142,0 @@ context?: any; |
@@ -232,11 +232,2 @@ /** | ||
this.silent = !!options.silent; | ||
// if it's null or an object, inherit from it. otherwise, copy it. | ||
const ctx = options.context; | ||
if (ctx !== undefined) { | ||
this.context = | ||
typeof ctx === 'object' ? Object.create(ctx) : ctx; | ||
} | ||
else { | ||
this.context = null; | ||
} | ||
this.bail = !!options.bail; | ||
@@ -400,2 +391,9 @@ this.strict = !!options.strict; | ||
this.#started = true; | ||
// if it's null or an object, inherit from it. otherwise, copy it. | ||
const ctx = this.context ?? | ||
('context' in this.options | ||
? this.options.context | ||
: this.parent?.context) ?? | ||
null; | ||
this.context = typeof ctx === 'object' ? Object.create(ctx) : ctx; | ||
this.hook.runInAsyncScope(this.main, this, cb); | ||
@@ -402,0 +400,0 @@ } |
@@ -328,2 +328,3 @@ import * as stack from '@tapjs/stack'; | ||
'failSkip', | ||
'diagnostic', | ||
]; | ||
@@ -1075,3 +1076,2 @@ for (const k of inheritedFlags) { | ||
} | ||
extra.context = this.context; | ||
this.#inheritFlags(extra); | ||
@@ -1078,0 +1078,0 @@ const t = new Class(extra); |
{ | ||
"name": "@tapjs/core", | ||
"version": "1.4.6", | ||
"version": "1.5.0", | ||
"description": "pluggable core of node-tap", | ||
@@ -56,3 +56,3 @@ "tshy": { | ||
"@tapjs/stack": "1.2.7", | ||
"@tapjs/test": "1.3.17", | ||
"@tapjs/test": "1.4.0", | ||
"async-hook-domain": "^4.0.1", | ||
@@ -59,0 +59,0 @@ "diff": "^5.1.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
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
850165
10513
+ Added@tapjs/after@1.1.18(transitive)
+ Added@tapjs/after-each@1.1.18(transitive)
+ Added@tapjs/asserts@1.1.18(transitive)
+ Added@tapjs/before@1.1.18(transitive)
+ Added@tapjs/before-each@1.1.18(transitive)
+ Added@tapjs/filter@1.2.18(transitive)
+ Added@tapjs/fixture@1.2.18(transitive)
+ Added@tapjs/intercept@1.2.18(transitive)
+ Added@tapjs/mock@1.3.0(transitive)
+ Added@tapjs/node-serialize@1.3.0(transitive)
+ Added@tapjs/snapshot@1.2.18(transitive)
+ Added@tapjs/spawn@1.1.18(transitive)
+ Added@tapjs/stdin@1.1.18(transitive)
+ Added@tapjs/test@1.4.0(transitive)
+ Added@tapjs/typescript@1.4.0(transitive)
+ Added@tapjs/worker@1.1.18(transitive)
- Removed@tapjs/after@1.1.17(transitive)
- Removed@tapjs/after-each@1.1.17(transitive)
- Removed@tapjs/asserts@1.1.17(transitive)
- Removed@tapjs/before@1.1.17(transitive)
- Removed@tapjs/before-each@1.1.17(transitive)
- Removed@tapjs/filter@1.2.17(transitive)
- Removed@tapjs/fixture@1.2.17(transitive)
- Removed@tapjs/intercept@1.2.17(transitive)
- Removed@tapjs/mock@1.2.15(transitive)
- Removed@tapjs/node-serialize@1.2.6(transitive)
- Removed@tapjs/snapshot@1.2.17(transitive)
- Removed@tapjs/spawn@1.1.17(transitive)
- Removed@tapjs/stdin@1.1.17(transitive)
- Removed@tapjs/test@1.3.17(transitive)
- Removed@tapjs/typescript@1.3.6(transitive)
- Removed@tapjs/worker@1.1.17(transitive)
Updated@tapjs/test@1.4.0