简体   繁体   English

通过 VS Code 中的热键运行 Rspec 块

[英]Run Rspec block via hot key in VS Code

Is there a way to configure VS Code to run an Rspec block in the current cursor position?有没有办法配置 VS Code 在当前光标位置运行 Rspec 块?

Either a describe or it block. describeit阻止。

I found similar functionality through Atom with the Rspec extension.我通过带有 Rspec 扩展的 Atom 发现了类似的功能。 A hot key became available Cmd + alt + X .一个热键可用Cmd + alt + X Which would trigger the single it or a group within describe depending where the cursor was.这将触发单个itdescribe的组,具体取决于光标所在的位置。

You can install this extension https://marketplace.visualstudio.com/items?itemName=noku.rails-run-spec-vscode你可以安装这个扩展https://marketplace.visualstudio.com/items?itemName=noku.rails-run-spec-vscode

And then press Cmd + L to run the specific describe or it然后按Cmd + L运行特定的describeit

I installed Rails Test Runner .我安装了Rails Test Runner Open your spec file, put your cursor on/in the describe or it block, then right click.打开您的规范文件,将光标放在describeit块上/中,然后右键单击。 You see 2 choices:您会看到 2 个选择:

  1. Run all tests in file运行文件中的所有测试
  2. Run tests starting from the current line从当前行开始运行测试

To set up RSpec to run in VS Code, with breakpoints, see my answer .要将 RSpec 设置为在 VS Code 中运行,并带有断点,请参阅我的回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM