Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for TAP reporter when given invalid reporter option #3673

Merged
merged 1 commit into from
Jan 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions test/integration/reporters.spec.js
Original file line number Diff line number Diff line change
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