diff options
author | Debadree Chatterjee <debadree333@gmail.com> | 2022-12-02 11:59:48 +0530 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2023-01-04 20:31:49 -0500 |
commit | bf6fbe2c494f92d719305bee6b28672e8eab2b72 (patch) | |
tree | a9721206d2d70bdd6c6d3acafc7ded48b11da5cf | |
parent | a327a7874a4f7b4ca0d8a8369531e44606cb187c (diff) | |
download | node-new-bf6fbe2c494f92d719305bee6b28672e8eab2b72.tar.gz |
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>
-rw-r--r-- | lib/internal/test_runner/test.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 9372cb7032..c56c03c072 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -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() { |