More Related Content
Similar to Testing Javascript with Jasmine (19)
More from André Faria Gomes (20)
Testing Javascript with Jasmine
- 2. Jasmine is a behavior-driven
development framework for testing
your JavaScript code.
- 3. It does not depend on any other
JavaScript frameworks
- 5. It has a clean, obvious syntax so that
you can easily write tests.
- 11. Disabling
describe => xdescribe
it => xit
- 12. Matchers
expect(x).toEqual(y);
expect(x).toBe(y); //same
expect(x).toMatch(pattern); //regex
expect(x).toBeDefined(); //not undefined
expect(x).toBeNull();
expect(x).toBeTruthy();
expect(x).toBeFalsy();
expect(x).toContain(y); //for arrays or strings
expect(x).toBeLessThan(y);
expect(x).toBeGreaterThan(y);
expect(fn).toThrow(e);
expect(x).not.toEqual(y);
- 15. Spies
Spies are automatically removed after each spec.
They may be set in the beforeEach function
- 24. HTML /src
SpecRunner.html /spec
- 26. NodeJS
package
npm install jasmine-node --global
jasmine-node scripts