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

describe("constructor") causes markdown reporter to bomb #554

Closed
MandarinConLaBarba opened this issue Aug 24, 2012 · 3 comments
Closed

describe("constructor") causes markdown reporter to bomb #554

MandarinConLaBarba opened this issue Aug 24, 2012 · 3 comments

Comments

@MandarinConLaBarba
Copy link

Error output:
TypeError: Cannot call method 'fullTitle' of undefined
at stringifyTOC (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/reporters/markdown.js:58:72)
at stringifyTOC (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/reporters/markdown.js:60:14)
at stringifyTOC (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/reporters/markdown.js:60:14)
at generateTOC (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/reporters/markdown.js:68:12)
at new Markdown (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/reporters/markdown.js:71:3)
at Mocha.run (/Users/mandarin/code/Kilgore/node_modules/mocha/lib/mocha.js:232:18)
at Object. (/Users/mandarin/code/Kilgore/node_modules/mocha/bin/_mocha:322:7)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)

Changing the string to "the constructor" makes it happy.

@PavelVanecek
Copy link

+1

@dasilvacontin
Copy link
Contributor

Indeed, it does. +1

@dasilvacontin
Copy link
Contributor

Problem is line 39 of the reporter. When title is already a key in the object, it fails to assign the new object. I think I should be able to fix it with a namespace.

obj = obj[suite.title] = obj[suite.title] || { suite: suite };

In context:

function mapTOC(suite, obj) {
    var ret = obj;
    obj = obj[suite.title] = obj[suite.title] || { suite: suite };
    suite.suites.forEach(function(suite){
      mapTOC(suite, obj);
    });
    return ret;
  }

boneskull pushed a commit that referenced this issue Dec 15, 2014
prefix/namespace for suite titles in markdown reporter, fixes #554
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

No branches or pull requests

3 participants