From 4faa1ae1e7cab32bc5df87f99bdc0ee28d65805b Mon Sep 17 00:00:00 2001 From: Misha Hariachyi Date: Wed, 15 Nov 2023 21:17:45 +0100 Subject: [PATCH 1/2] Fix for issue #81 import('vscode-uri').default Fresh wdio-vscode-service project is not starting. Error message: `TypeError: Cannot destructure property 'URI' of '(intermediate value).default' as it is undefined` - The solution has used already at `@wdio/utils/build/utils.js:204` - The import that was changed here has been working without `.default` 11 month ago, before the change 1562cd1 --- src/server/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/utils.ts b/src/server/utils.ts index bc719d79..795844ea 100644 --- a/src/server/utils.ts +++ b/src/server/utils.ts @@ -3,7 +3,8 @@ import path from 'node:path' import { fsProviderExtensionPrefix, fsProviderFolderUri } from './constants.js' -const { URI } = (await import('vscode-uri')).default +const vscodeUri = await import('vscode-uri') +const { URI } = vscodeUri.default ? vscodeUri.default : vscodeUri export interface IConfig { readonly extensionPaths: string[] | undefined From 9f3b245cab672ac580e89546a9acad7752ef2007 Mon Sep 17 00:00:00 2001 From: Misha Hariachyi Date: Wed, 15 Nov 2023 21:18:21 +0100 Subject: [PATCH 2/2] Fixed lint warnings by using log.error --- src/pageobjects/editor/TextEditor.ts | 5 ++++- src/pageobjects/menu/WindowControls.ts | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pageobjects/editor/TextEditor.ts b/src/pageobjects/editor/TextEditor.ts index 363e761d..1fa77a36 100644 --- a/src/pageobjects/editor/TextEditor.ts +++ b/src/pageobjects/editor/TextEditor.ts @@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url' import clipboard from 'clipboardy' import { Key, ChainablePromiseElement } from 'webdriverio' +import logger from '@wdio/logger' import { ContentAssist, ContextMenu, InputBox } from '../index.js' import { StatusBar } from '../statusBar/StatusBar.js' import { Editor, EditorLocators } from './Editor.js' @@ -15,6 +16,8 @@ import { } from '../../locators/1.73.0.js' import { CMD_KEY } from '../../constants.js' +const log = logger('wdio-vscode-service') + export interface TextEditor extends IPageDecorator {} /** * Page object representing the active text editor @@ -370,7 +373,7 @@ export class TextEditor extends Editor { try { await menu.select('Format Document') } catch (err) { - console.log('Warn: Format Document not available for selected language') + log.error('Warn: Format Document not available for selected language') if (await menu.elem.isDisplayed()) { await menu.close() } diff --git a/src/pageobjects/menu/WindowControls.ts b/src/pageobjects/menu/WindowControls.ts index f825fa77..774ee607 100644 --- a/src/pageobjects/menu/WindowControls.ts +++ b/src/pageobjects/menu/WindowControls.ts @@ -1,11 +1,14 @@ import type { ChainablePromiseElement } from 'webdriverio' +import logger from '@wdio/logger' import { PageDecorator, IPageDecorator, BasePage, VSCodeLocatorMap } from '../utils.js' import { TitleBar } from '../../index.js' import { WindowControls as WindowControlsLocators } from '../../locators/1.73.0.js' +const log = logger('wdio-vscode-service') + export interface WindowControls extends IPageDecorator {} /** * Page object for the windows controls part of the title bar @@ -44,7 +47,7 @@ export class WindowControls extends BasePage { try { await this.maximize$.click() } catch (err) { - console.log('Window is already maximized') + log.error('Window is already maximized', err) } } @@ -56,7 +59,7 @@ export class WindowControls extends BasePage { try { await this.restore$.click() } catch (err) { - console.log('Window is not maximized') + log.error('Window is not maximized', err) } }