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

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

Comments

Projects
None yet
3 participants

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.

Owner

dasilvacontin commented Nov 11, 2014

Indeed, it does. +1

Owner

dasilvacontin commented Nov 11, 2014

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 boneskull closed this in 1de1c10 Dec 15, 2014

@boneskull boneskull added a commit that referenced this issue Dec 15, 2014

@boneskull boneskull Merge pull request #1427 from dasilvacontin/issue/554
prefix/namespace for suite titles in markdown reporter, fixes #554
3018e9d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment