Jasmine ES5 代码片段是专门为 Visual Studio Code 用户设计的扩展工具,旨在简化使用 Jasmine 测试框架的过程。灵感来源于 Sublime Jasmine Snippets,并对触发器进行了适当的修改,使其更加符合用户的使用习惯。
安装方法:
通过命令面板安装非常简单,只需按下 cmd-shift-p(Mac)或 ctrl-shift-p(Windows/Linux),然后选择“Extensions: Install Extension”,搜索并安装此扩展包。
代码片段列表:
以下是所有可用代码片段及其触发器的详细列表。请注意,⇥ 表示 TAB 键。
| 触发器 | 描述 |
|---|---|
| desc→ | describe 方法 |
| xdesc→ | xdescribe 方法 |
| fdesc→ | fdescribe 方法 |
| it→ | it 方法 |
| xit→ | xit 方法 |
| fit→ | fit 方法 |
| ba→ | before all 方法 |
| aa→ | after all 方法 |
| be→ | before each 方法 |
| ae→ | after each 方法 |
| 触发器 | 描述 |
|---|---|
| exp→ | expect |
| tb→ | expect().toBe |
| tbct→ | expect().toBeCloseTo |
| tbd→ | expect().toBeDefined |
| tbf→ | expect().toBeFalsy |
| tbgt→ | expect().toBeGreaterThan |
| tblt→ | expect().toBeLessThan |
| tbn→ | expect().toBeNull |
| tbt→ | expect().toBeTruthy |
| tbu→ | expect().toBeUndefined |
| tc→ | expect().toContain |
| te→ | expect().toEqual |
| thbc→ | expect().toHaveBeenCalled |
| thbcw→ | expect().toHaveBeenCalledWith |
| tm→ | expect().toMatch |
| tt→ | expect().toThrow |
| tte→ | expect().toThrowError |
| nb→ | expect().not.toBe |
| nbct→ | expect().not.toBeCloseTo |
| nbd→ | expect().not.toBeDefined |
| nbf→ | expect().not.toBeFalsy |
| nbgt→ | expect().not.toBeGreaterThan |
| nblt→ | expect().not.toBeLessThan |
| nbn→ | expect().not.toBeNull |
| nbt→ | expect().not.toBeTruthy |
| nbu→ | expect().not.toBeUndefined |
| nc→ | expect().not.toContain |
| ne→ | expect().not.toEqual |
| nm→ | expect().not.toMatch |
| nt→ | expect().not.toThrow |
| any→ | jasmine.any |
| oc→ | jasmine.objectContaining |
| 触发器 | 内容 |
|---|---|
| so→ | spyOn |
| soct→ | spyOn.and.callThrough |
| socf→ | spyOn.and.callFake |
| sorv→ | spyOn.and.returnValue |
| sos→ | spyOn.and.stub |
| sote→ | spyOn.and.throwError |
| sca→ | spy.calls.all |
| scaa→ | spy.calls.allArgs |
| scan→ | spy.calls.any |
| scaf→ | spy.calls.argsFor |
| scc→ | spy.calls.count |
| scf→ | spy.calls.first |
| scmr→ | spy.calls.mostRecent |
| scr→ | spy.calls.reset |
| cs→ | createSpy |
| cso→ | createSpyObj |
许可证:
本扩展包遵循 MIT 许可证发布。
通过使用 Jasmine ES5 代码片段,您可以显著提高在 Visual Studio Code 中进行 Jasmine 测试的效率。这些精心设计的触发器和代码片段将帮助您更快地编写和管理测试代码,提升您的开发体验。

本站所有资源都是由网友投稿发布,或转载各大下载站, 请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则 产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:study_golang@163.com