8000 GitHub - zkilgore/jest: Painless JavaScript Unit Testing built on top of the Jasmine test framework.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zkilgore/jest

 
 

Repository files navigation

Painless JavaScript Unit Testing

< 8000 ul dir="auto">
  • Familiar Approach: Built on top of the Jasmine test framework, using familiar expect(value).toBe(other) assertions

  • Mock by Default: Automatically mocks CommonJS modules returned by require(), making most existing code testable

  • Short Feedback Loop: DOM APIs are mocked and tests run in parallel via a small node.js command line utility

  • Getting Started

    Check out the Getting Started tutorial. It's pretty simple!

    API

    <generated_api_start />

    The jest object

    Mock functions

    Config options

    Globally injected variables

    • afterEach(fn)
    • beforeEach(fn)
    • describe(name, fn)
    • it(name, fn)
    • it.only(name, fn) executes only this test. Useful when investigating a failure
    • jest
    • pit(name, fn) helper for promises
    • require(module)
    • require.requireActual(module)
    • xdescribe(name, fn)
    • xit(name, fn)

    expect(value)

    • .not inverse the next comparison
    • .toThrow(?message)
    • .toBe(value) comparison using ===
    • .toEqual(value) deep comparison. Use jasmine.any(type) to be softer
    • .toBeFalsy()
    • .toBeTruthy()
    • .toBeNull()
    • .toBeUndefined()
    • .toBeDefined()
    • .toMatch(regexp)
    • .toContain(string)
    • .toBeCloseTo(number, delta)
    • .toBeGreaterThan(number)
    • .toBeLessThan(number)
    • .toBeCalled()
    • .toBeCalledWith(arg, um, ents)
    • .lastCalledWith(arg, um, ents)

    <generated_api_end />

    About

    Painless JavaScript Unit Testing built on top of the Jasmine test framework.

    Resources

    License

    Stars

    Watchers

    Forks

    Packages

    No packages published

    Languages

    • JavaScript 95.0%
    • CSS 4.7%
    • Other 0.3%
    0