Skip to content

Commit

Permalink
fix: pr comments fixed with namings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bayheck committed Dec 7, 2023
1 parent e472ae3 commit de6844a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/runner/fixture-hook-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getFixtureInfo } from '../utils/get-test-and-fixture-info';

interface FixtureState {
started: boolean;
blockedUntilFixtureBeforeHookIsExecuted: boolean;
testIsBlocked: boolean;
fixtureBeforeHookErr: null | Error;
pendingTestRunCount: number;
fixtureCtx: object;
Expand All @@ -24,11 +24,11 @@ export default class FixtureHookController {
private static _ensureFixtureMapItem (fixtureMap: Map<Fixture, FixtureState>, fixture: Fixture): void {
if (!fixtureMap.has(fixture)) {
const item = {
started: false,
blockedUntilFixtureBeforeHookIsExecuted: false,
fixtureBeforeHookErr: null,
pendingTestRunCount: 0,
fixtureCtx: Object.create(null),
started: false,
testIsBlocked: false,
fixtureBeforeHookErr: null,
pendingTestRunCount: 0,
fixtureCtx: Object.create(null),
};

fixtureMap.set(fixture, item);
Expand Down Expand Up @@ -58,22 +58,22 @@ export default class FixtureHookController {
public isTestBlocked (test: Test): boolean {
const item = this._getFixtureMapItem(test);

return !!item && item.blockedUntilFixtureBeforeHookIsExecuted;
return !!item && item.testIsBlocked;
}

public unblockWhenBeforeHooksComplete (test: Test): void {
public unblockTest (test: Test): void {
const item = this._getFixtureMapItem(test);

if (item)
item.blockedUntilFixtureBeforeHookIsExecuted = false;
item.testIsBlocked = false;
}

public blockIfBeforeHooksExist (test: Test): void {
public blockTestIfNecessary (test: Test): void {
const fixture = test.fixture as Fixture;
const item = this._getFixtureMapItem(test);
const item = this._getFixtureMapItem(test);

if (item && (fixture.globalBeforeFn || fixture.beforeFn))
item.blockedUntilFixtureBeforeHookIsExecuted = true;
item.testIsBlocked = true;
}

private async _runFixtureBeforeHook (item: FixtureState, fn: Function, testRun: TestRun): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/runner/test-run-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ export default class TestRunController extends AsyncEventEmitter {

await this._handleNativeAutomationMode(connection);

this._fixtureHookController.blockIfBeforeHooksExist(this.test);
this._fixtureHookController.blockTestIfNecessary(this.test);

const testRun = await this._createTestRun(connection, startRunExecutionTime);

const hookOk = await this._testRunHook.runTestRunBeforeHookIfNecessary(testRun)
&& await this._fixtureHookController.runFixtureBeforeHookIfNecessary(testRun);

this._fixtureHookController.unblockWhenBeforeHooksComplete(this.test);
this._fixtureHookController.unblockTest(this.test);

if (this.test.skip || !hookOk) {
await this._emitTestRunStart();
Expand Down

0 comments on commit de6844a

Please sign in to comment.