From 07ccd39075ba2cb9981235cfc97ee3d30ea2b472 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 8 Jan 2025 23:16:50 -0800 Subject: [PATCH] test: use instanceof --- test/functional/commands/clipboard-e2e-specs.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/functional/commands/clipboard-e2e-specs.js b/test/functional/commands/clipboard-e2e-specs.js index 78af93a5..f231fefa 100644 --- a/test/functional/commands/clipboard-e2e-specs.js +++ b/test/functional/commands/clipboard-e2e-specs.js @@ -1,5 +1,6 @@ import { initSession, deleteSession, MOCHA_TIMEOUT } from '../helpers/session'; import { APIDEMO_CAPS } from '../desired'; +import { AssertionError } from 'assert'; describe('clipboard', function () { @@ -27,9 +28,13 @@ describe('clipboard', function () { const text = await driver.getClipboard('PLAINTEXT'); try { text.should.eql('SGVsbG8='); - } catch (AssertionError) { // eslint-disable-line @typescript-eslint/no-unused-vars - // API level 23 and 25 emulator has '\n' - text.should.eql('SGVsbG8=\n'); + } catch (e) { + if (e instanceof AssertionError) { + // API level 23 and 25 emulator has '\n' + text.should.eql('SGVsbG8=\n'); + } else { + throw e; + } } (Buffer.from(text, 'base64').toString()).should.eql('Hello'); });