NASA Proceeds to Mars

    jest-matcher-percent-error
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.3 • Public • Published

    jest-matcher-percent-error

    npm GitHub Workflow Status

    This is a simple matcher for Jest that tests whether the actual value matches the expected value, within some specified percent error.

    Installation

    With npm:

    $ npm install --save-dev jest-matcher-percent-error

    Usage

    To test whether the result of foo() is within 10% of 100:

    import toBeWithinPercent from "jest-matcher-percent-error";
    
    expect.extend({ toBeWithinPercent });
    
    test("foo works", () => {
      expect(foo()).toBeWithinPercent(100, 10);
    });

    License

    This is free software, distributed under the MIT license.

    Install

    npm i jest-matcher-percent-error

    DownloadsWeekly Downloads

    4

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    14.2 kB

    Total Files

    8

    Last publish

    Collaborators

    • ianprime0509