Navigation Menu

Skip to content

Commit

Permalink
lib: added SuiteContext class
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
debadree25 authored and danielleadams committed Jan 3, 2023
1 parent ed9246f commit 55f800b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/internal/test_runner/test.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 55f800b

Please sign in to comment.