Jasmine ES5 Code Snippets

Jasmine ES5 Code Snippets 1.0.1

分类: 工具软件
来源:点击进入
版本:1.0.1 日期:2025.07.06
立即下载

探索JasmineES5代码片段,专门为VisualStudioCode用户设计,简化Jasmine测试框架的使用。通过一系列易用的触发器,快速生成测试代码,提升开发效率。

下载介绍

Jasmine ES5 代码片段是专门为 Visual Studio Code 用户设计的扩展工具,旨在简化使用 Jasmine 测试框架的过程。灵感来源于 Sublime Jasmine Snippets,并对触发器进行了适当的修改,使其更加符合用户的使用习惯。

安装方法:

通过命令面板安装非常简单,只需按下 cmd-shift-p(Mac)或 ctrl-shift-p(Windows/Linux),然后选择“Extensions: Install Extension”,搜索并安装此扩展包。

代码片段列表:

以下是所有可用代码片段及其触发器的详细列表。请注意,⇥ 表示 TAB 键。

测试规范(Specs)

触发器描述
desc→describe 方法
xdesc→xdescribe 方法
fdesc→fdescribe 方法
it→it 方法
xit→xit 方法
fit→fit 方法
ba→before all 方法
aa→after all 方法
be→before each 方法
ae→after each 方法

期望(Expectations)

触发器描述
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

间谍(Spies)

触发器内容
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 测试的效率。这些精心设计的触发器和代码片段将帮助您更快地编写和管理测试代码,提升您的开发体验。

返回顶部