mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
lib: added SuiteContext class
added SuiteContext class to replace object literal Fixes: https://github.com/nodejs/node/issues/45641 Refs: https://github.com/nodejs/node/issues/45641#issuecomment-1329130581 PR-URL: https://github.com/nodejs/node/pull/45687 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
ed9246f6fc
commit
55f800b806
1 file changed
+18
-1
@@ -146,6 +146,22 @@ class TestContext {
|
||||
}
|
||||
}
|
||||
|
||||
class SuiteContext {
|
||||
#suite;
|
||||
|
||||
constructor(suite) {
|
||||
this.#suite = suite;
|
||||
}
|
||||
|
||||
get signal() {
|
||||
return this.#suite.signal;
|
||||
}
|
||||
|
||||
get name() {
|
||||
return this.#suite.name;
|
||||
}
|
||||
}
|
||||
|
||||
class Test extends AsyncResource {
|
||||
#abortController;
|
||||
#outerSignal;
|
||||
@@ -737,7 +753,8 @@ class Suite extends Test {
|
||||
}
|
||||
|
||||
getRunArgs() {
|
||||
return { ctx: { signal: this.signal, name: this.name }, args: [] };
|
||||
const ctx = new SuiteContext(this);
|
||||
return { ctx, args: [ctx] };
|
||||
}
|
||||
|
||||
async run() {
|
||||
|
||||
Reference in new issue
Block a user