Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ryan-shaw opened this issue Oct 21, 2015 · 0 comments · Fixed by #2081
Closed

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

ryan-shaw opened this issue Oct 21, 2015 · 0 comments · Fixed by #2081

Comments

@ryan-shaw
Copy link

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...

@ryan-shaw ryan-shaw changed the title Uncaught TypeError: Cannot read property 'toString' of undefined this.skip causes: Cannot read property 'toString' of undefined Oct 21, 2015
ryan-shaw pushed a commit to ryan-shaw/mocha that referenced this issue Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant