JSPM

zora-tap-reporter

2.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 98
    • Score
      100M100P100Q68489F
    • License MIT

    TAP reporters for zora testing library

    Package Exports

    • zora-tap-reporter

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zora-tap-reporter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    zora-tap-reporter

    Test Anything Protocol reporters for zora.

    Two flavors of TAP protocol which work both on the browser and on Nodejs

    Install

    npm install zora-tap-reporter

    TAP reporter

    Basic TAP reporter which outputs a TAP stream compatible with any tape reporter

    import {createHarness} from 'zora';
    import {tapReporter} from 'zora-tap-reporter';
    
    const h = createHarness();
    
    const {test} = h;
    
    test(`hello world`, t => {
        t.ok(true);
    
        t.test('nested', t => {
            t.eq('foo', 'fob');
        });
    });
    
    test(`hello world`, t => {
        t.ok(true);
    
        t.test('nested', t => {
            t.eq('foo', 'fob');
        });
    });
    
    h.report(tapReporter());

    will output

    TAP version 13
    # hello world
    ok 1 - should be truthy
    # nested
    not ok 2 - should be equivalent
      ---
        actual: "foo"
        expected: "fob"
        operator: "equal"
        at: " file:///Volumes/data/code/zora-reporters/tap/example.mjs:12:11"
      ...
    # hello world
    ok 3 - should be truthy
    # nested
    not ok 4 - should be equivalent
      ---
        actual: "foo"
        expected: "fob"
        operator: "equal"
        at: " file:///Volumes/data/code/zora-reporters/tap/example.mjs:20:11"
      ...
    1..4
    
    # not ok
    # success: 2
    # skipped: 0
    # failure: 2

    Indented TAP reporter

    Richer structure which can be parsed by any TAP parser and will provide better information for parsers (or downstream reporters) which understand this specific structure. Example: tap-mocha-reporter

    import {createHarness} from 'zora';
    import {indentedTapReporter} from 'zora-tap-reporter';
    
    const h = createHarness();
    
    const {test} = h;
    
    test(`hello world`, t => {
        t.ok(true);
    
        t.test('nested', t => {
            t.eq('foo', 'fob');
        });
    });
    
    test(`hello world`, t => {
        t.ok(true);
    
        t.test('nested', t => {
            t.eq('foo', 'fob');
        });
    });
    
    h.report(indentedTapReporter());

    will output

    TAP version 13
    # Subtest: hello world
        ok 1 - should be truthy
        # Subtest: nested
            not ok 1 - should be equivalent
              ---
                wanted: "fob"
                found: "foo"
                at: " file:///Volumes/data/code/zora-reporters/tap/example.mjs:12:11"
                operator: "equal"
              ...
            1..1
        not ok 2 - nested # 5ms
        1..2
    not ok 1 - hello world # 7ms
    # Subtest: hello world
        ok 1 - should be truthy
        # Subtest: nested
            not ok 1 - should be equivalent
              ---
                wanted: "fob"
                found: "foo"
                at: " file:///Volumes/data/code/zora-reporters/tap/example.mjs:20:11"
                operator: "equal"
              ...
            1..1
        not ok 2 - nested # 3ms
        1..2
    not ok 2 - hello world # 3ms
    1..2
    
    # not ok
    # success: 2
    # skipped: 0
    # failure: 2