From 566dae6470c7bdb454db81c480c32248619afb5e Mon Sep 17 00:00:00 2001 From: Arvid Ottenberg Date: Tue, 12 May 2020 09:28:34 +0200 Subject: [PATCH] adapt test cases to changed forbidOnly logic --- test/integration/options/forbidOnly.spec.js | 35 ++++++++++++--------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/test/integration/options/forbidOnly.spec.js b/test/integration/options/forbidOnly.spec.js index 1886becb7d..252c5b99b9 100644 --- a/test/integration/options/forbidOnly.spec.js +++ b/test/integration/options/forbidOnly.spec.js @@ -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 ); });