Skip to content

Commit

Permalink
fix: correctly pass cli options to hermione "readTests" and "run"
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Jan 24, 2024
1 parent dd47018 commit 9a5101b
Show file tree
Hide file tree
Showing 4 changed files with 2,397 additions and 4,226 deletions.
23 changes: 20 additions & 3 deletions lib/gui/tool-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ import {ImagesInfoSaver} from '../../images-info-saver';
import {SqliteImageStore} from '../../image-store';

type ToolRunnerArgs = [paths: string[], hermione: Hermione & HtmlReporterApi, configs: GuiConfigs];
type ReplModeOption = {
enabled: boolean;
beforeTest: boolean;
onFail: boolean;
}

export type ToolRunnerTree = GuiReportBuilderResult & Pick<GuiCliOptions, 'autoRun'>;

Expand Down Expand Up @@ -128,8 +133,19 @@ export class ToolRunner {

async _readTests(): Promise<TestCollection> {
const {grep, set: sets, browser: browsers} = this._globalOpts;
const replMode = this._getReplModeOption();

return this._hermione.readTests(this._testFiles, {grep, sets, browsers});
return this._hermione.readTests(this._testFiles, {grep, sets, browsers, replMode});
}

_getReplModeOption(): ReplModeOption {
const {repl = false, replBeforeTest = false, replOnFail = false} = this._globalOpts;

return {
enabled: repl || replBeforeTest || replOnFail,
beforeTest: replBeforeTest,
onFail: replOnFail
};
}

protected _ensureReportBuilder(): GuiReportBuilder {
Expand Down Expand Up @@ -282,10 +298,11 @@ export class ToolRunner {
}

async run(tests: TestSpec[] = []): Promise<boolean> {
const {grep, set: sets, browser: browsers} = this._globalOpts;
const {grep, set: sets, browser: browsers, devtools = false} = this._globalOpts;
const replMode = this._getReplModeOption();

return createTestRunner(this._ensureTestCollection(), tests)
.run((collection) => this._hermione.run(collection, {grep, sets, browsers}));
.run((collection) => this._hermione.run(collection, {grep, sets, browsers, devtools, replMode}));
}

protected async _handleRunnableCollection(): Promise<void> {
Expand Down
Loading

0 comments on commit 9a5101b

Please sign in to comment.