Skip to content

Commit 55f800b

Browse files
debadree25danielleadams
authored andcommittedJan 3, 2023
lib: added SuiteContext class
added SuiteContext class to replace object literal Fixes: #45641 Refs: #45641 (comment) PR-URL: #45687 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent ed9246f commit 55f800b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed
 

‎lib/internal/test_runner/test.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ class TestContext {
146146
}
147147
}
148148

149+
class SuiteContext {
150+
#suite;
151+
152+
constructor(suite) {
153+
this.#suite = suite;
154+
}
155+
156+
get signal() {
157+
return this.#suite.signal;
158+
}
159+
160+
get name() {
161+
return this.#suite.name;
162+
}
163+
}
164+
149165
class Test extends AsyncResource {
150166
#abortController;
151167
#outerSignal;
@@ -737,7 +753,8 @@ class Suite extends Test {
737753
}
738754

739755
getRunArgs() {
740-
return { ctx: { signal: this.signal, name: this.name }, args: [] };
756+
const ctx = new SuiteContext(this);
757+
return { ctx, args: [ctx] };
741758
}
742759

743760
async run() {

0 commit comments

Comments
 (0)
Please sign in to comment.