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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
debadree25 authored and danielleadams committed Jan 4, 2023
1 parent c31c315 commit c647adb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
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 c647adb

Please sign in to comment.