-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ability to use devtools procotol through cli option #827
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ exports.run = () => { | |
) | ||
.option("--repl-before-test [type]", "open repl interface before test run", Boolean, false) | ||
.option("--repl-on-fail [type]", "open repl interface on test fail only", Boolean, false) | ||
.option("--devtools", "switches the browser to the devtools mode with using CDP protocol") | ||
.arguments("[paths...]") | ||
.action(async paths => { | ||
try { | ||
|
@@ -82,6 +83,7 @@ exports.run = () => { | |
repl, | ||
replBeforeTest, | ||
replOnFail, | ||
devtools, | ||
} = program; | ||
|
||
await handleRequires(requireModules); | ||
|
@@ -99,6 +101,7 @@ exports.run = () => { | |
beforeTest: replBeforeTest, | ||
onFail: replOnFail, | ||
}, | ||
devtools: devtools || false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Если |
||
}); | ||
|
||
process.exit(isTestsSuccess ? 0 : 1); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ interface RunOpts { | |
beforeTest: boolean; | ||
onFail: boolean; | ||
}; | ||
devtools: boolean; | ||
} | ||
|
||
interface ReadTestsOpts extends Pick<RunOpts, "browsers" | "sets" | "grep" | "replMode"> { | ||
|
@@ -69,12 +70,13 @@ export class Hermione extends BaseHermione { | |
requireModules, | ||
inspectMode, | ||
replMode, | ||
devtools, | ||
reporters = [], | ||
}: Partial<RunOpts> = {}, | ||
): Promise<boolean> { | ||
validateUnknownBrowsers(browsers, _.keys(this._config.browsers)); | ||
|
||
RuntimeConfig.getInstance().extend({ updateRefs, requireModules, inspectMode, replMode }); | ||
RuntimeConfig.getInstance().extend({ updateRefs, requireModules, inspectMode, replMode, devtools }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Опцию переданную из cli сохраняю в runtime конфиге, чтобы затем заюзать при создании браузера. |
||
|
||
if (replMode?.enabled) { | ||
this._config.system.mochaOpts.timeout = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если опция не указана, то
devtools: undefined
, а если указана тоdevtools: true