Skip to content

Commit 9d23ead

Browse files
committed
refactor!: remove the --open-app cli option (#4681)
1 parent ed5254e commit 9d23ead

File tree

6 files changed

+21
-55
lines changed

6 files changed

+21
-55
lines changed

lib/Server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,6 @@ class Server {
12441244
* @param {any} target
12451245
* @returns {NormalizedOpen[]}
12461246
*/
1247-
// TODO: remove --open-app in favor of --open-app-name
12481247
const getOpenItemsFromObject = ({ target, ...rest }) => {
12491248
const normalizedOptions = { ...defaultOpenOptions, ...rest };
12501249

@@ -2557,7 +2556,7 @@ class Server {
25572556
: ""
25582557
}`
25592558
: ""
2560-
}. 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".`
2559+
}. 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".`
25612560
);
25622561
});
25632562
})

lib/options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@
467467
"minLength": 1,
468468
"description": "Open specified browser.",
469469
"cli": {
470-
"description": "Open specified browser. Deprecated: please use '--open-app-name'."
470+
"exclude": true
471471
}
472472
}
473473
],

test/cli/__snapshots__/basic.test.js.snap.webpack5

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ Options:
9898
--no-open Does not open the default browser.
9999
--open-target <value...> Opens specified page in browser.
100100
--open-app-name <value...> Open specified browser.
101-
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
102101
--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).
103102
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
104103
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.

test/cli/open-option.test.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,6 @@ describe('"open" CLI option', () => {
7575
expect(exitCode).toEqual(0);
7676
});
7777

78-
it('should work using "--open-app google-chrome"', async () => {
79-
const { exitCode } = await testBin([
80-
"--port",
81-
port,
82-
"--open-app",
83-
"google-chrome",
84-
]);
85-
86-
expect(exitCode).toEqual(0);
87-
});
88-
8978
it('should work using "--open-app-name google-chrome"', async () => {
9079
const { exitCode } = await testBin([
9180
"--port",
@@ -144,19 +133,6 @@ describe('"open" CLI option', () => {
144133
expect(exitCode).toEqual(0);
145134
});
146135

147-
it('should work using "--open-target /index.html --open-app google-chrome"', async () => {
148-
const { exitCode } = await testBin([
149-
"--port",
150-
port,
151-
"--open-target",
152-
"/index.html",
153-
"--open-app",
154-
"google-chrome",
155-
]);
156-
157-
expect(exitCode).toEqual(0);
158-
});
159-
160136
it('should work using "--open-target /index.html --open-app-name google-chrome"', async () => {
161137
const { exitCode } = await testBin([
162138
"--port",
@@ -169,19 +145,4 @@ describe('"open" CLI option', () => {
169145

170146
expect(exitCode).toEqual(0);
171147
});
172-
173-
it('should work using "--open-target /index.html --open-app google-chrome --open-app-name google-chrome"', async () => {
174-
const { exitCode } = await testBin([
175-
"--port",
176-
port,
177-
"--open-target",
178-
"/index.html",
179-
"--open-app",
180-
"google-chrome",
181-
"--open-app-name",
182-
"google-chrome",
183-
]);
184-
185-
expect(exitCode).toEqual(0);
186-
});
187148
});

test/server/open-option.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ describe('"open" option', () => {
747747
wait: false,
748748
});
749749
expect(loggerWarnSpy).toHaveBeenCalledWith(
750-
`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".`
750+
`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".`
751751
);
752752

753753
getInfrastructureLoggerSpy.mockRestore();
@@ -783,7 +783,7 @@ describe('"open" option', () => {
783783
wait: false,
784784
});
785785
expect(loggerWarnSpy).toHaveBeenCalledWith(
786-
`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".`
786+
`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".`
787787
);
788788

789789
getInfrastructureLoggerSpy.mockRestore();
@@ -823,7 +823,7 @@ describe('"open" option', () => {
823823
wait: false,
824824
});
825825
expect(loggerWarnSpy).toHaveBeenCalledWith(
826-
`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".`
826+
`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".`
827827
);
828828

829829
loggerWarnSpy.mockRestore();
@@ -869,7 +869,7 @@ describe('"open" option', () => {
869869
wait: false,
870870
});
871871
expect(loggerWarnSpy).toHaveBeenCalledWith(
872-
`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".`
872+
`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".`
873873
);
874874

875875
getInfrastructureLoggerSpy.mockRestore();
@@ -931,11 +931,11 @@ describe('"open" option', () => {
931931
);
932932
expect(loggerWarnSpy).toHaveBeenNthCalledWith(
933933
1,
934-
`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".`
934+
`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".`
935935
);
936936
expect(loggerWarnSpy).toHaveBeenNthCalledWith(
937937
2,
938-
`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".`
938+
`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".`
939939
);
940940

941941
getInfrastructureLoggerSpy.mockRestore();

types/lib/Server.d.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ declare class Server {
22682268
minLength: number;
22692269
description: string;
22702270
cli: {
2271-
description: string;
2271+
exclude: boolean;
22722272
};
22732273
additionalProperties?: undefined;
22742274
properties?: undefined;
@@ -2329,14 +2329,17 @@ declare class Server {
23292329
}
23302330
)[];
23312331
};
2332+
/**
2333+
* @type {string[]}
2334+
*/
23322335
}
23332336
)[];
23342337
description: string;
23352338
link: string;
23362339
};
23372340
Server: {
23382341
anyOf: {
2339-
$ref: string;
2342+
$ref: string /** @type {ClientConfiguration} */;
23402343
}[];
23412344
link: string;
23422345
description: string;
@@ -2353,7 +2356,6 @@ declare class Server {
23532356
ServerString: {
23542357
type: string;
23552358
minLength: number;
2356-
/** @type {ServerConfiguration} */
23572359
cli: {
23582360
exclude: boolean;
23592361
};
@@ -2416,11 +2418,12 @@ declare class Server {
24162418
items?: undefined;
24172419
}
24182420
)[];
2419-
description: string /** @type {number | string} */;
2421+
description: string;
24202422
};
24212423
cert: {
24222424
anyOf: (
24232425
| {
2426+
/** @type {number | string} */
24242427
type: string;
24252428
items: {
24262429
anyOf: (
@@ -2503,7 +2506,7 @@ declare class Server {
25032506
}
25042507
)[];
25052508
};
2506-
/** @type {ClientConfiguration} */ instanceof?: undefined;
2509+
instanceof?: undefined;
25072510
}
25082511
| {
25092512
type: string;
@@ -2586,6 +2589,10 @@ declare class Server {
25862589
}
25872590
| {
25882591
type: string;
2592+
/**
2593+
* @private
2594+
* @returns {Compiler["options"]}
2595+
*/
25892596
cli: {
25902597
negatedDescription: string;
25912598
};
@@ -2599,7 +2606,7 @@ declare class Server {
25992606
cli?: undefined;
26002607
}
26012608
)[];
2602-
description: string;
2609+
/** @type {MultiCompiler} */ description: string;
26032610
link: string;
26042611
};
26052612
StaticObject: {

0 commit comments

Comments
 (0)