Dealing with the deprecated `document.queryCommandSupported`

19 Views Asked by At

I have trouble running vitest (in the "happy-dom" environment) for UI code that uses the deprecated document.queryCommandSupported function. This deprecated function is being used by the microsoft/vscoode library in the clipboard file which is being used as a dependency in my codebase.

This is the error:

TypeError: document.queryCommandSupported is not a function
 ❯ ../../node_modules/vscode/vscode/src/vs/editor/contrib/clipboard/browser/clipboard.js:16:92

The UI is rendering quite well in both Chrome and Firefox but it is not working with Vitest as it throws the error that the document.queryCommandSupported is not found. Any suggestions on how to get this to work in vitest? Switching the testing environment to "jsdom" throws the same error.

0

There are 0 best solutions below