This is a collection of jasmine statements common in my day by day.
Found some typo? Miss something else cool? Let me now or make a pull request!
- Install
- Supported languages
- Snippets
- Custom
- Globals
- afterAll (.js and .ts only)
- afterEach (.js and .ts only)
- beforeAll (.js and .ts only)
- beforeEach (.js and .ts only)
- describe (.js and .ts only)
- expect (.js and .ts only)
- fdescribe (.js and .ts only)
- fit (.js and .ts only)
- it (.js and .ts only)
- pending (.js and .ts only)
- spyOn (.js and .ts only)
- xdescribe (.js and .ts only)
- xit (.js and .ts only)
- Matchers
- nothing (.js and .ts only)
- toBe (.js and .ts only)
- toBeCloseTo (.js and .ts only)
- toBeCloseTo (with precision) (.js and .ts only)
- toBeDefined (.js and .ts only)
- toBeFalsy (.js and .ts only)
- toBeGreaterThan (.js and .ts only)
- toBeGreaterThanOrEqual (.js and .ts only)
- toBeLessThan (.js and .ts only)
- toBeLessThanOrEqual (.js and .ts only)
- toBeNan (.js and .ts only)
- toBeNegativeInfinity (.js and .ts only)
- toBeNull (.js and .ts only)
- toBePositiveInfinity (.js and .ts only)
- toBeTruthy (.js and .ts only)
- toBeUndefined (.js and .ts only)
- toContain (.js and .ts only)
- toEqual (.js and .ts only)
- toHaveBeenCalled (.js and .ts only)
- toHaveBeenCalledBefore (.js and .ts only)
- toHaveBeenCalledTimes (.js and .ts only)
- toHaveBeenCalledWith (.js and .ts only)
- toMatch (.js and .ts only)
- Spys
apm install jasmine-snippets
- JavaScript
- Python
- Ruby
- TypeScript
Below I list all the available snippet's prefix. I'm not will cover what they produces, 'cause will only be a copy-paste from .cson files.
- JavaScript
- Python
- Ruby
- TypeScript
var myCustomEquality = function(first, second) {
// return true or false if first and second are comparable,
// otherwise, doesn't return nothig.
};
beforeEach(function () {
jasmine.addCustomEqualityTester(myCustomEquality);
});
var customMatchers = {
toBeCompared: function (util, curstomEqualityTester) {
return {
compare: function (actual, expected) {
...[negative]C[negative]C
var result = {};
// Assign result.pass to true or false, and result.message to some string
return result;
}
}
};
...
};
beforeEach(function () {
jasmine.addCustomEqualityTester(customMatchers);
});
- JavaScript
- Python
- Ruby
- TypeScript
afterAll
afterEach
beforeAll
beforeEach
describe
expect
fdescribe
fit
it
pend
spyOn
xdescribe
xit
- JavaScript
- Python
- Ruby
- TypeScript
exp-n
exp-tb
exp-tbct
exp-tbctp
exp-tbd
exp-tbf
exp-tbgt
exp-tbgtoe
exp-tblt
exp-tbltoe
exp-nan
exp-ninf
exp-null
exp-inf
exp-tbt
exp-tbud
exp-tc
exp-teq
exp-thbc
exp-thbcb
exp-thbct
exp-thbcw
exp-tm
- JavaScript
- Python
- Ruby
- TypeScript
jasm-spy
jasm-spyobj // for only one method
jasm-spyobjs // for multiple methods
jasm-fake
jasm-through
jasm-retValue
jasm-retValues
jasm-error