Skip to content

Commit 9a5101b

Browse files
committed
fix: correctly pass cli options to hermione "readTests" and "run"
1 parent dd47018 commit 9a5101b

File tree

4 files changed

+2397
-4226
lines changed

4 files changed

+2397
-4226
lines changed

lib/gui/tool-runner/index.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ import {ImagesInfoSaver} from '../../images-info-saver';
4848
import {SqliteImageStore} from '../../image-store';
4949

5050
type ToolRunnerArgs = [paths: string[], hermione: Hermione & HtmlReporterApi, configs: GuiConfigs];
51+
type ReplModeOption = {
52+
enabled: boolean;
53+
beforeTest: boolean;
54+
onFail: boolean;
55+
}
5156

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

@@ -128,8 +133,19 @@ export class ToolRunner {
128133

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

132-
return this._hermione.readTests(this._testFiles, {grep, sets, browsers});
138+
return this._hermione.readTests(this._testFiles, {grep, sets, browsers, replMode});
139+
}
140+
141+
_getReplModeOption(): ReplModeOption {
142+
const {repl = false, replBeforeTest = false, replOnFail = false} = this._globalOpts;
143+
144+
return {
145+
enabled: repl || replBeforeTest || replOnFail,
146+
beforeTest: replBeforeTest,
147+
onFail: replOnFail
148+
};
133149
}
134150

135151
protected _ensureReportBuilder(): GuiReportBuilder {
@@ -282,10 +298,11 @@ export class ToolRunner {
282298
}
283299

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

287304
return createTestRunner(this._ensureTestCollection(), tests)
288-
.run((collection) => this._hermione.run(collection, {grep, sets, browsers}));
305+
.run((collection) => this._hermione.run(collection, {grep, sets, browsers, devtools, replMode}));
289306
}
290307

291308
protected async _handleRunnableCollection(): Promise<void> {

0 commit comments

Comments
 (0)