Jasmine Code Snippets:VS Code中的Jasmine测试利器
Jasmine Code Snippets是一款专为VS Code设计的扩展,旨在提升您在Jasmine测试框架下的开发效率。该扩展基于@NicoSantangelo的sublime-jasmine包,提供了丰富的代码片段,帮助您快速编写Jasmine测试。
安装指南:
要安装此扩展,只需启动VS Code的命令面板(Ctrl+Shift+P或Cmd+Shift+P),输入“Extensions”,然后选择安装新扩展即可。
支持的语言(文件扩展名):
代码片段概览:
我们为您准备了多种代码片段,涵盖了Jasmine测试的各个方面,包括:
详细片段列表:
触发器 | 内容 |
---|---|
desc→ | describe方法 |
xdesc→ | xdescribe方法 |
fdesc→ | fdescribe方法 |
it→ | it方法 |
xit→ | xit方法 |
fit→ | fit方法 |
ae→ | after each方法 |
be→ | before 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 |
nct→ | expect().not.toBeCloseTo |
nd→ | expect().not.toBeDefined |
nf→ | expect().not.toBeFalsy |
ngt→ | expect().not.toBeGreaterThan |
nlt→ | expect().not.toBeLessThan |
nn→ | expect().not.toBeNull |
nt→ | expect().not.toBeTruthy |
nu→ | 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 |
sct→ | spyOn.and.callThrough |
scf→ | spyOn.and.callFake |
spg→ | spyOnProperty($obj,'$property', 'get') |
sps→ | spyOnProperty($obj,'$property', 'set') |
srv→ | spyOn.and.returnValue |
ss→ | spyOn.and.stub |
ste→ | spyOn.and.throwError |
ca→ | spy.calls.all |
caa→ | spy.calls.allArgs |
ca→ | spy.calls.any |
caf→ | spy.calls.argsFor |
cc→ | spy.calls.count |
cf→ | spy.calls.first |
cmr→ | spy.calls.mostRecent |
cr→ | spy.calls.reset |
cs→ | createSpy |
cso→ | createSpyObj |
总结:
Jasmine Code Snippets扩展为VS Code用户提供了强大的Jasmine测试框架支持。无论您是初学者还是经验丰富的开发者,都能从这些代码片段中受益,提升测试效率,提高代码质量。
本站所有资源都是由网友投稿发布,或转载各大下载站, 请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则 产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:study_golang@163.com