Skip to content

Commit

Permalink
test(integration/reporters.spec.js): Add test for TAP when given inva…
Browse files Browse the repository at this point in the history
…lid reporter option

Added test for invalid reporter option for `tapVersion`.
  • Loading branch information
plroebuck authored and boneskull committed Jan 17, 2019
1 parent 414bc1e commit c838315
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions test/integration/reporters.spec.js
Expand Up @@ -134,7 +134,7 @@ describe('reporters', function() {
describe('produces valid TAP v13 output', function() {
var runFixtureAndValidateOutput = function(fixture, expected) {
it('for ' + fixture, function(done) {
var args = ['--reporter=tap', '--reporter-options', 'tapVersion=13'];
var args = ['--reporter=tap', '--reporter-option', 'tapVersion=13'];

run(fixture, args, function(err, res) {
if (err) {
Expand Down Expand Up @@ -196,8 +196,42 @@ describe('reporters', function() {
});
});

it('should fail if given invalid `tapVersion`', function(done) {
var invalidTapVersion = 'nosuch';
var args = [
'--reporter=tap',
'--reporter-option',
'tapVersion=' + invalidTapVersion
];

run(
'reporters.fixture.js',
args,
function(err, res) {
if (err) {
done(err);
return;
}

function dquote(s) {
return '"' + s + '"';
}

var pattern =
'^Error: invalid or unsupported TAP version: ' +
dquote(invalidTapVersion);
expect(res, 'to satisfy', {
code: 1,
output: new RegExp(pattern, 'm')
});
done();
},
{stdio: 'pipe'}
);
});

it('places exceptions correctly in YAML blocks', function(done) {
var args = ['--reporter=tap', '--reporter-options', 'tapVersion=13'];
var args = ['--reporter=tap', '--reporter-option', 'tapVersion=13'];

run('reporters.fixture.js', args, function(err, res) {
if (err) {
Expand Down

0 comments on commit c838315

Please sign in to comment.