Skip to content

Commit

Permalink
adapt forbidOnly integration tests to check for failure if only suite…
Browse files Browse the repository at this point in the history
… is not selected by grep
  • Loading branch information
arvidOtt committed May 5, 2020
1 parent f871782 commit 336425a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/integration/options/forbidOnly.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,37 @@ describe('--forbid-only', function() {
);
});

it('should succeed if suite marked only does not match grep', function(done) {
it('should fail if suite marked only does not match grep', function(done) {
var fixture = path.join('options', 'forbid-only', 'only-suite');
runMochaJSON(fixture, args.concat('--fgrep', 'bumble bees'), function(
err,
res
) {
if (err) {
return done(err);
}
expect(res, 'to have passed');
done();
});
var spawnOpts = {stdio: 'pipe'};
runMocha(
fixture,
args.concat('--fgrep', 'bumble bees'),
function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have failed with output', new RegExp(onlyErrorMessage));
done();
},
spawnOpts
);
});

it('should succeed if suite marked only does not match inverted grep', function(done) {
it('should fail if suite marked only does not match inverted grep', function(done) {
var fixture = path.join('options', 'forbid-only', 'only-suite');
runMochaJSON(
var spawnOpts = {stdio: 'pipe'};
runMocha(
fixture,
args.concat('--fgrep', 'suite marked with only', '--invert'),
function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have passed');
expect(res, 'to have failed with output', new RegExp(onlyErrorMessage));
done();
}
},
spawnOpts
);
});

Expand Down

0 comments on commit 336425a

Please sign in to comment.