stp

simple-tap-parser

Javascript tap file parser

Showing:

Popularity

Downloads/wk

1

GitHub Stars

1

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.7KB

License

BSD-2-Clause

Type Definitions

Tree-Shakeable

No?

Categories

Readme

tap-parser Build Status

A javascript tap file parser

Usage / Example

for the following tap file test-result.tap

1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid.
More output from test 2. There can be
  arbitrary number of lines for any output
  so long as there is at least some kind
  of whitespace at beginning of line.
ok 3 - Read the rest of the file
#TAP meta information
not ok 4 - Summarized correctly # TODO Not written yet

get the content of your tap file as a string then put it in the parser:

var parser = new tap.Parser( tapFileString );

parser.getTest(1).isValid(); // => true
parser.getTest(2).getLabel(); // => First line of the input valid

parser.getTestCount(); // => 4
parser.getValidCount(); // => 2
parser.getFailedCount(); // => 2

parser.getTest(3).getDetails(); // => arbitrary number of (...) beginning of line.

//loop on each test
parser.tests.forEach( function( test ){
  test.isValid();
});

Install / Download

NPM

npm install simple-tap-parser

Bower

bower install simple-tap-parser

RequireJS

module is UMD compliant so you can load it with RequireJS

define([
  'path/to/tap-parser',
  'text!my-tap-fil.tap'
], function( tap, tapFile ){
  
  var parser = new tap.Parser( tapFile );

});

Old school

<script src="path/to/tap.js"></script>
<script>
  new tap.Parser( tapString );
</script>

tap-parser is released under the GPL v2.

Copyright (c) 2014 Franck Ernewein, See LICENSE for details.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100