lundi 23 juillet 2018

mocha, using this.skip() to skip tests dynamically doesn't work

i'm trying to skip tests if a condition returns true using this.skip() inside an "it", but i'm getting an error "this.skip is not a function". this is the simple code i'm trying to check it on:

    var async = require('async');
var should = require('chai').should();
var chai = require('chai'),
should = chai.should();
expect = chai.expect;
chai.use(require('chai-sorted'));

describe('Testing skip...\n', function() {
        this.timeout(1000);
        it('test1', (done) => {
            this.skip();
            console.log("1")
            done();
        });

        it('test2', (done) => {         
            console.log("2");
            done();
        }); 

});

i installed mocha@5.2.0 since i saw it only works on since mocha v3.0.0, but i still cant get it to work, and none of the past discussions on the subject seems to fix my problem.

Aucun commentaire:

Enregistrer un commentaire