如何在 vscode 测试中访问编辑器 [英] How to access the editor in vscode tests

查看:30
本文介绍了如何在 vscode 测试中访问编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 VSCode 创建一个扩展,用于重新格式化编辑器文本的一部分.

I am creating a extension for VSCode that reformats part of the editor text.

我该如何对此进行测试.

How can I make a test for this.

我不知道如何在测试中创建一个 TextEditor 来模拟打开的文件.

I can't figure how to create a TextEditor inside the test to simulate a opened file.

推荐答案

您应该能够为您的测试文件打开 VS Code.

You should be able to open VS Code for your test file.

请参阅此文档:https://code.visualstudio.com/Docs/extensions/测试扩展

不确定您是否可以针对您正在寻找的内容进行测试.您可能只能检查错误,而不是测试这个 UI 元素在这里吗?"

Not sure if you can test against what you are looking for exactly though. You might just be able to check for errors, rather than test "is this UI element here?"

这篇关于如何在 vscode 测试中访问编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆