-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: open editor when clicking error on overlay #4587
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 |
---|---|---|
|
@@ -2033,6 +2033,19 @@ class Server { | |
} | ||
); | ||
|
||
/** @type {import("express").Application} */ | ||
(app).get("/webpack-dev-server/open-editor", (req, res) => { | ||
const fileName = req.query.fileName; | ||
|
||
if (typeof fileName === "string") { | ||
// @ts-ignore | ||
const launchEditor = require("launch-editor"); | ||
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. require lazily to make mock possible. |
||
launchEditor(fileName); | ||
} | ||
|
||
res.end(); | ||
}); | ||
|
||
/** @type {import("express").Application} */ | ||
(app).get( | ||
"/webpack-dev-server", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,16 @@ | |
const puppeteer = require("puppeteer"); | ||
const { puppeteerArgs } = require("./puppeteer-constants"); | ||
|
||
/** | ||
* @typedef {Object} RunBrowserResult | ||
* @property {import('puppeteer').Page} page | ||
* @property {import('puppeteer').Browser} browser | ||
*/ | ||
|
||
/** | ||
* @param {Parameters<import('puppeteer').Page['emulate']>[0]} config | ||
* @returns {Promise<RunBrowserResult>} | ||
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. Additional typing to improve intellisense while writing tests. |
||
*/ | ||
function runBrowser(config) { | ||
const options = { | ||
viewport: { | ||
|
@@ -14,7 +24,13 @@ function runBrowser(config) { | |
}; | ||
|
||
return new Promise((resolve, reject) => { | ||
/** | ||
* @type {import('puppeteer').Page} | ||
*/ | ||
let page; | ||
/** | ||
* @type {import('puppeteer').Browser} | ||
*/ | ||
let browser; | ||
|
||
puppeteer | ||
|
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.
this is hook for e2e test. If there is other preferred convention, let me know!