diff --git a/src/index.ts b/src/index.ts index b95a3d2..bbefcc8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,7 +71,7 @@ function executeQuery( container: HTMLElement, ...args: any[] ) { - const done = args.pop() as (result: any) => void; + const done = args.pop() as (result: any) => void // @ts-ignore function deserializeObject(object) { @@ -96,16 +96,20 @@ function executeQuery( const [matcher, options, waitForOptions] = args.map(deserializeArg) - Promise.resolve( - window.TestingLibraryDom[query]( - container, - matcher, - options, - waitForOptions, - ), - ) - .then(done) - .catch((e) => done(e.message)) + try { + Promise.resolve( + window.TestingLibraryDom[query]( + container, + matcher, + options, + waitForOptions, + ), + ) + .then(done) + .catch((e) => done(e.message)) + } catch (e) { + done(e.message) + } } /* diff --git a/test/async/configure.e2e.ts b/test/async/configure.e2e.ts index 73e0e6d..cd2f96e 100644 --- a/test/async/configure.e2e.ts +++ b/test/async/configure.e2e.ts @@ -47,7 +47,7 @@ describe('configure', () => { await expect(() => getByTestId('button-that-should-not-use-testid'), ).rejects.toThrowError( - 'TestingLibraryElementError: A better query is available', + 'A better query is available', ) }) diff --git a/wdio.conf.js b/wdio.conf.js index c17b223..8f5630d 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -77,7 +77,7 @@ exports.config = { // Define all options that are relevant for the WebdriverIO instance here // // Level of logging verbosity: trace | debug | info | warn | error | silent - logLevel: 'silent', + logLevel: 'warn', // // Set specific log levels per logger // loggers: