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

a more descriptive/user-friendly error when describe title is not provided #1632

Closed
dasilvacontin opened this issue Mar 27, 2015 · 3 comments

Comments

@dasilvacontin
Copy link
Contributor

describe(function () {
    before(function () {
        this.credentials = {id: 123};
    })

    it('should work', function () {
        expect(this.credentials.id).to.equal(123);
    })
})
/usr/local/lib/node_modules/mocha/lib/interfaces/bdd.js:49
      fn.call(suite);
         ^
TypeError: Cannot call method 'call' of undefined
    at context.describe.context.context (/usr/local/lib/node_modules/mocha/lib/interfaces/bdd.js:49:10)
    at Object.<anonymous> (/Users/dasilvacontin/temp/test/kek.js:1:63)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:187:27
    at Array.forEach (native)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:184:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:405:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:405:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
@dasilvacontin dasilvacontin added the status: accepting prs Mocha can use your help with this one! label Mar 27, 2015
@dasilvacontin
Copy link
Contributor Author

And if the it title is not set... well, it thinks that it's a pending test and the title is the function:

  setting vars inside before
    - function () {
        expect(this.credentials.id).to.equal(123);
    }


  0 passing (5ms)
  1 pending

a8m added a commit to a8m/mocha that referenced this issue Jul 18, 2015
Throw a user-friendly error when the suite title or the test-case title
isn't provided.
a8m added a commit to a8m/mocha that referenced this issue Nov 12, 2015
Throw a user-friendly error when the suite title or the test-case title
isn't provided.
boneskull pushed a commit that referenced this issue Jul 2, 2016
Throw a user-friendly error when the suite title or the test-case title
isn't provided.
boneskull pushed a commit that referenced this issue Aug 1, 2016
Throw a user-friendly error when the suite title or the test-case title
isn't provided.
@1999
Copy link
Contributor

1999 commented Aug 13, 2016

@boneskull probably it's time to close this issue now?

@dasilvacontin
Copy link
Contributor Author

@1999 thanks for pointing it out! Closing.

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