Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,6 @@ class Server {
* @param {any} target
* @returns {NormalizedOpen[]}
*/
// TODO: remove --open-app in favor of --open-app-name
const getOpenItemsFromObject = ({ target, ...rest }) => {
const normalizedOptions = { ...defaultOpenOptions, ...rest };

Expand Down Expand Up @@ -2496,7 +2495,7 @@ class Server {
: ""
}`
: ""
}. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
}. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);
});
})
Expand Down
2 changes: 1 addition & 1 deletion lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
"minLength": 1,
"description": "Open specified browser.",
"cli": {
"description": "Open specified browser. Deprecated: please use '--open-app-name'."
"exclude": true
}
}
],
Expand Down
1 change: 0 additions & 1 deletion test/cli/__snapshots__/basic.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Options:
--no-open Does not open the default browser.
--open-target <value...> Opens specified page in browser.
--open-app-name <value...> Open specified browser.
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
--open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
Expand Down
39 changes: 0 additions & 39 deletions test/cli/open-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ describe('"open" CLI option', () => {
expect(exitCode).toEqual(0);
});

it('should work using "--open-app google-chrome"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--open-app",
"google-chrome",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--open-app-name google-chrome"', async () => {
const { exitCode } = await testBin([
"--port",
Expand Down Expand Up @@ -144,19 +133,6 @@ describe('"open" CLI option', () => {
expect(exitCode).toEqual(0);
});

it('should work using "--open-target /index.html --open-app google-chrome"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--open-target",
"/index.html",
"--open-app",
"google-chrome",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--open-target /index.html --open-app-name google-chrome"', async () => {
const { exitCode } = await testBin([
"--port",
Expand All @@ -169,19 +145,4 @@ describe('"open" CLI option', () => {

expect(exitCode).toEqual(0);
});

it('should work using "--open-target /index.html --open-app google-chrome --open-app-name google-chrome"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--open-target",
"/index.html",
"--open-app",
"google-chrome",
"--open-app-name",
"google-chrome",
]);

expect(exitCode).toEqual(0);
});
});
12 changes: 6 additions & 6 deletions test/server/open-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ describe('"open" option', () => {
wait: false,
});
expect(loggerWarnSpy).toHaveBeenCalledWith(
`Unable to open "http://localhost:${port}/" page. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/" page. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);

getInfrastructureLoggerSpy.mockRestore();
Expand Down Expand Up @@ -783,7 +783,7 @@ describe('"open" option', () => {
wait: false,
});
expect(loggerWarnSpy).toHaveBeenCalledWith(
`Unable to open "http://localhost:${port}/index.html" page. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/index.html" page. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);

getInfrastructureLoggerSpy.mockRestore();
Expand Down Expand Up @@ -823,7 +823,7 @@ describe('"open" option', () => {
wait: false,
});
expect(loggerWarnSpy).toHaveBeenCalledWith(
`Unable to open "http://localhost:${port}/index.html" page in "google-chrome" app. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/index.html" page in "google-chrome" app. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);

loggerWarnSpy.mockRestore();
Expand Down Expand Up @@ -869,7 +869,7 @@ describe('"open" option', () => {
wait: false,
});
expect(loggerWarnSpy).toHaveBeenCalledWith(
`Unable to open "http://localhost:${port}/index.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/index.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);

getInfrastructureLoggerSpy.mockRestore();
Expand Down Expand Up @@ -931,11 +931,11 @@ describe('"open" option', () => {
);
expect(loggerWarnSpy).toHaveBeenNthCalledWith(
1,
`Unable to open "http://localhost:${port}/first.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/first.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);
expect(loggerWarnSpy).toHaveBeenNthCalledWith(
2,
`Unable to open "http://localhost:${port}/second.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app".`
`Unable to open "http://localhost:${port}/second.html" page in "google-chrome" app with "--incognito --new-window" arguments. If you are running in a headless environment, please do not use the "open" option or related flags like "--open", "--open-target", and "--open-app-name".`
);

getInfrastructureLoggerSpy.mockRestore();
Expand Down
18 changes: 9 additions & 9 deletions types/lib/Server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ declare class Server {
minLength: number;
description: string;
cli: {
description: string;
exclude: boolean;
};
additionalProperties?: undefined;
properties?: undefined;
Expand Down Expand Up @@ -845,8 +845,9 @@ declare class Server {
}
)[];
description: string;
link: string;
link: string /** @type {ClientConfiguration} */;
};
/** @type {ClientConfiguration} */
Server: {
anyOf: {
$ref: string;
Expand All @@ -860,12 +861,12 @@ declare class Server {
ServerEnum: {
enum: string[];
cli: {
exclude: boolean /** @type {ServerConfiguration} */;
exclude: boolean;
};
};
ServerString: {
type: string;
minLength: number;
/** @type {ServerConfiguration} */ minLength: number;
cli: {
exclude: boolean;
};
Expand All @@ -880,7 +881,7 @@ declare class Server {
};
options: {
$ref: string;
};
} /** @type {string} */;
};
additionalProperties: boolean;
};
Expand Down Expand Up @@ -1100,12 +1101,12 @@ declare class Server {
cli: {
negatedDescription: string;
};
/** @type {MultiCompiler} */ items?: undefined;
items?: undefined;
$ref?: undefined;
}
| {
$ref: string;
type?: undefined;
/** @type {MultiCompiler} */ type?: undefined;
items?: undefined;
cli?: undefined /** @typedef {import("express").Request} Request */;
}
Expand All @@ -1117,11 +1118,10 @@ declare class Server {
type: string;
additionalProperties: boolean;
properties: {
/** @type {MultiCompiler} */
directory: {
type: string;
minLength: number;
description: string;
/** @type {MultiCompiler} */ description: string;
link: string;
};
staticOptions: {
Expand Down