From d473fd9a55334efd8d349aa2b37c64b395dea025 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Thu, 15 Apr 2021 21:48:27 +0530 Subject: [PATCH] fix: improve warning message for `open` (#3191) --- lib/utils/runOpen.js | 2 +- test/server/open-option.test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/utils/runOpen.js b/lib/utils/runOpen.js index dbfdf5cd41..a76d7bae9b 100644 --- a/lib/utils/runOpen.js +++ b/lib/utils/runOpen.js @@ -73,7 +73,7 @@ function runOpen(uri, options, logger) { .join(' ')}" arguments` : ` in "${openTask.options.app}" app` : '' - }. If you are running in a headless environment, please do not use the "--open" flag or the "open" option.` + }. 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".` ); }); }) diff --git a/test/server/open-option.test.js b/test/server/open-option.test.js index b142ba6dff..58d3506a36 100644 --- a/test/server/open-option.test.js +++ b/test/server/open-option.test.js @@ -676,7 +676,7 @@ describe('"open" option', () => { wait: false, }); expect(loggerWarnSpy).toHaveBeenCalledWith( - 'Unable to open "http://localhost:8117/" page. If you are running in a headless environment, please do not use the "--open" flag or the "open" option.' + 'Unable to open "http://localhost:8117/" 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".' ); loggerWarnSpy.mockRestore(); @@ -705,7 +705,7 @@ describe('"open" option', () => { wait: false, }); expect(loggerWarnSpy).toHaveBeenCalledWith( - 'Unable to open "http://localhost:8117/index.html" page. If you are running in a headless environment, please do not use the "--open" flag or the "open" option.' + 'Unable to open "http://localhost:8117/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".' ); loggerWarnSpy.mockRestore(); @@ -738,7 +738,7 @@ describe('"open" option', () => { wait: false, }); expect(loggerWarnSpy).toHaveBeenCalledWith( - 'Unable to open "http://localhost:8117/index.html" page in "google-chrome" app. If you are running in a headless environment, please do not use the "--open" flag or the "open" option.' + 'Unable to open "http://localhost:8117/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".' ); loggerWarnSpy.mockRestore(); @@ -771,7 +771,7 @@ describe('"open" option', () => { wait: false, }); expect(loggerWarnSpy).toHaveBeenCalledWith( - 'Unable to open "http://localhost:8117/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" flag or the "open" option.' + 'Unable to open "http://localhost:8117/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".' ); loggerWarnSpy.mockRestore(); @@ -817,11 +817,11 @@ describe('"open" option', () => { ); expect(loggerWarnSpy).toHaveBeenNthCalledWith( 1, - 'Unable to open "http://localhost:8117/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" flag or the "open" option.' + 'Unable to open "http://localhost:8117/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".' ); expect(loggerWarnSpy).toHaveBeenNthCalledWith( 2, - 'Unable to open "http://localhost:8117/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" flag or the "open" option.' + 'Unable to open "http://localhost:8117/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".' ); loggerWarnSpy.mockRestore();