tap-parse-string-to-object

Parses raw Tap: string-to-object or stream-to-a-promise-of-an-object

Usage no npm install needed!

<script type="module">
  import tapParseStringToObject from 'https://cdn.skypack.dev/tap-parse-string-to-object';
</script>

README

tap-parse-string-to-object

Parses raw Tap: string-to-object or stream-to-a-promise-of-an-object

Install

npm i tap-parse-string-to-object

Quick Take

import { strict as assert } from "assert";
import { parseTap } from "tap-parse-string-to-object";

// synchronous parsing (there's also async, see in examples)
assert.deepEqual(
  parseTap(`TAP version 13
ok 1 - test/test.js # time=22.582ms { # Subtest: 01.01 - string input
ok 1 - 01.01.01
ok 2 - 01.01.02
1..2
ok 1 - 01.01 - string input # time=7.697ms

 # Subtest: 01.02 - non-string input
ok 1 - 01.02.01
ok 2 - 01.02.02
ok 3 - 01.02.03
ok 4 - 01.02.04
ok 5 - 01.02.05
1..5
ok 2 - 01.02 - non-string input # time=2.791ms

 1..2 # time=22.582ms
}

ok 2 - test/umd-test.js # time=16.522ms { # Subtest: UMD build works fine
ok 1 - should be equivalent
1..1
ok 1 - UMD build works fine # time=10.033ms

 1..1 # time=16.522ms
}

1..2

# time=1816.082ms
`),
  {
    ok: true,
    assertsTotal: 8,
    assertsPassed: 8,
    assertsFailed: 0,
    suitesTotal: 2,
    suitesPassed: 2,
    suitesFailed: 0,
  }
);

Documentation

Please visit codsen.com for a full description of the API and examples.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright (c) 2010-2021 Roy Revelt and other contributors

ok codsen star