Skip to content

Commit

Permalink
additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Jan 22, 2020
1 parent 17068a3 commit d444da0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
8 changes: 8 additions & 0 deletions test/integration/fixtures/pending/programmatic.fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';
const Mocha = require('../../../../lib/mocha');

const mocha = new Mocha({reporter: 'json'});
mocha.addFile("./test/integration/fixtures/__default__.fixture.js");

const runner = mocha.run();
runner.on('test', function (test) { test.pending = true; });
26 changes: 23 additions & 3 deletions test/integration/pending.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
'use strict';

var assert = require('assert');
var run = require('./helpers').runMochaJSON;
var runMocha = require('./helpers').runMocha;
var splitRegExp = require('./helpers').splitRegExp;
var helpers = require('./helpers');
var run = helpers.runMochaJSON;
var runMocha = helpers.runMocha;
var splitRegExp = helpers.splitRegExp;
var invokeNode = helpers.invokeNode;
var toJSONRunResult = helpers.toJSONRunResult;
var args = [];

describe('pending', function() {
Expand Down Expand Up @@ -323,4 +326,21 @@ describe('pending', function() {
});
});
});

describe('programmatic usage', function() {
it('should skip the test listening to test event', function(done) {
var path = require.resolve('./fixtures/pending/programmatic.fixture.js');
invokeNode([path], function(err, res) {
if (err) {
return done(err);
}
var result = toJSONRunResult(res);
expect(result, 'to have passed')
.and('to have passed test count', 0)
.and('to have pending test count', 1)
.and('to have pending test order', 'should succeed');
done();
});
});
});
});

0 comments on commit d444da0

Please sign in to comment.