Skip to content

this.skip causes: Cannot read property 'toString' of undefined #1936

Closed

Description

Error line in mocha.js

    var el;
    if (test.state === 'passed') {
      var url = self.testURL(test);
      el = fragment('<li class="test pass %e"><h2>%e<span class="duration">%ems</span> <a href="%s" class="replay">‣</a></h2></li>', test.speed, test.title, test.duration, url);
    } else if (test.pending) {
      el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
    } else {
      el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>', test.title, self.testURL(test));
      var stackString; // Note: Includes leading newline
      var message = test.err.toString(); // mocha.js:2427

My test cases are

describe('mod', function(){
  describe('mod1', function(){
    before(function(){
       if(!modLoaded) this.skip(); // causes the error
    });

    it('should do stuff', function(){
       // stuff
    });
  });
});

Not sure why this.skip() is causing an error...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions