Skip to content

Commit 60512c3

Browse files
authored
refactor!: remove the --open-app cli option (#4681)
1 parent e6950e2 commit 60512c3

File tree

6 files changed

+17
-58
lines changed

6 files changed

+17
-58
lines changed

lib/Server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,6 @@ class Server {
11981198
* @param {any} target
11991199
* @returns {NormalizedOpen[]}
12001200
*/
1201-
// TODO: remove --open-app in favor of --open-app-name
12021201
const getOpenItemsFromObject = ({ target, ...rest }) => {
12031202
const normalizedOptions = { ...defaultOpenOptions, ...rest };
12041203

@@ -2496,7 +2495,7 @@ class Server {
24962495
: ""
24972496
}`
24982497
: ""
2499-
}. 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".`
2498+
}. 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".`
25002499
);
25012500
});
25022501
})

lib/options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
"minLength": 1,
437437
"description": "Open specified browser.",
438438
"cli": {
439-
"description": "Open specified browser. Deprecated: please use '--open-app-name'."
439+
"exclude": true
440440
}
441441
}
442442
],

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ Options:
9696
--no-open Does not open the default browser.
9797
--open-target <value...> Opens specified page in browser.
9898
--open-app-name <value...> Open specified browser.
99-
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
10099
--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).
101100
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
102101
--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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ declare class Server {
781781
minLength: number;
782782
description: string;
783783
cli: {
784-
description: string;
784+
exclude: boolean;
785785
};
786786
additionalProperties?: undefined;
787787
properties?: undefined;
@@ -845,8 +845,9 @@ declare class Server {
845845
}
846846
)[];
847847
description: string;
848-
link: string;
848+
link: string /** @type {ClientConfiguration} */;
849849
};
850+
/** @type {ClientConfiguration} */
850851
Server: {
851852
anyOf: {
852853
$ref: string;
@@ -860,12 +861,12 @@ declare class Server {
860861
ServerEnum: {
861862
enum: string[];
862863
cli: {
863-
exclude: boolean /** @type {ServerConfiguration} */;
864+
exclude: boolean;
864865
};
865866
};
866867
ServerString: {
867868
type: string;
868-
minLength: number;
869+
/** @type {ServerConfiguration} */ minLength: number;
869870
cli: {
870871
exclude: boolean;
871872
};
@@ -880,7 +881,7 @@ declare class Server {
880881
};
881882
options: {
882883
$ref: string;
883-
};
884+
} /** @type {string} */;
884885
};
885886
additionalProperties: boolean;
886887
};
@@ -1100,12 +1101,12 @@ declare class Server {
11001101
cli: {
11011102
negatedDescription: string;
11021103
};
1103-
/** @type {MultiCompiler} */ items?: undefined;
1104+
items?: undefined;
11041105
$ref?: undefined;
11051106
}
11061107
| {
11071108
$ref: string;
1108-
type?: undefined;
1109+
/** @type {MultiCompiler} */ type?: undefined;
11091110
items?: undefined;
11101111
cli?: undefined /** @typedef {import("express").Request} Request */;
11111112
}
@@ -1117,11 +1118,10 @@ declare class Server {
11171118
type: string;
11181119
additionalProperties: boolean;
11191120
properties: {
1120-
/** @type {MultiCompiler} */
11211121
directory: {
11221122
type: string;
11231123
minLength: number;
1124-
description: string;
1124+
/** @type {MultiCompiler} */ description: string;
11251125
link: string;
11261126
};
11271127
staticOptions: {

0 commit comments

Comments
 (0)