From ba610440ab8134416af0eaa178f7c61523148e71 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 22 Sep 2021 13:52:53 -0700 Subject: [PATCH] js: Fix @typescript-eslint/no-floating-promises. Signed-off-by: Anders Kaseorg --- frontend_tests/puppeteer_lib/common.ts | 9 ++++++++- frontend_tests/puppeteer_tests/subscriptions.ts | 8 ++++---- static/js/blueslip.ts | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/frontend_tests/puppeteer_lib/common.ts b/frontend_tests/puppeteer_lib/common.ts index 7536240ce0..fb1e9477c4 100644 --- a/frontend_tests/puppeteer_lib/common.ts +++ b/frontend_tests/puppeteer_lib/common.ts @@ -496,7 +496,7 @@ class CommonUtils { ); } - async run_test(test_function: (page: Page) => Promise): Promise { + async run_test_async(test_function: (page: Page) => Promise): Promise { // Pass a page instance to test so we can take // a screenshot of it when the test fails. const browser = await this.ensure_browser(); @@ -602,6 +602,13 @@ class CommonUtils { await browser.close(); } } + + run_test(test_function: (page: Page) => Promise): void { + this.run_test_async(test_function).catch((error) => { + console.error(error); + process.exit(1); + }); + } } export default new CommonUtils(); diff --git a/frontend_tests/puppeteer_tests/subscriptions.ts b/frontend_tests/puppeteer_tests/subscriptions.ts index 14888e25a4..f983670710 100644 --- a/frontend_tests/puppeteer_tests/subscriptions.ts +++ b/frontend_tests/puppeteer_tests/subscriptions.ts @@ -68,13 +68,13 @@ async function test_subscription_button_verona_stream(page: Page): Promise // We assume Verona is already subscribed, so the first line here // should happen immediately. button = await subscribed(); - button!.click(); + await button!.click(); button = await unsubscribed(); - button!.click(); + await button!.click(); button = await subscribed(); - button!.click(); + await button!.click(); button = await unsubscribed(); - button!.click(); + await button!.click(); button = await subscribed(); } diff --git a/static/js/blueslip.ts b/static/js/blueslip.ts index 091f935571..48cfc84041 100644 --- a/static/js/blueslip.ts +++ b/static/js/blueslip.ts @@ -85,7 +85,7 @@ function report_error( if (page_params.development_environment) { // In development, we display blueslip errors in the web UI, // to make them hard to miss. - blueslip_stacktrace.display_stacktrace(msg, stack); + void blueslip_stacktrace.display_stacktrace(msg, stack); } const key = ":" + msg + stack; @@ -108,7 +108,7 @@ function report_error( // // Important: We don't use channel.js here so that exceptions // always make it to the server even if reload_state.is_in_progress. - $.ajax({ + void $.ajax({ type: "POST", url: "/json/report/error", dataType: "json",