Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Weird --globals behavior for my own global settings #60

Open
binarykitchen opened this issue Apr 9, 2013 · 0 comments
Open

Weird --globals behavior for my own global settings #60

binarykitchen opened this issue Apr 9, 2013 · 0 comments

Comments

@binarykitchen
Copy link

Hello guys

mocha is behaving weird with my own global settings. When I add settings to --globals then no test is run.

How to reproduce?

In test/mocha.opts I have this:

--ui tdd
--reporter spec
--check-leaks
--globals utile, settings

in my express app I have this somewhere in my app code:

global.settings = app.settings;

so, when I run make test I get this:

> make test


  0 tests complete (3 ms)

Weird! And when I remove settings from --globals and run make test again, then it says that a global leak has been detected:

> make test
test


  pages
    index
      1) "before each" hook
      ✓ http results (335ms)
    faq
      ✓ http results 
    versions
      ✓ http results 
    clean
      ✓ http results (354ms)
    pages gone
      ✓ http results (102ms)
    non existing pages
      ✓ http results 


  ✖ 1 of 6 tests failed:

  1) pages "before each" hook:
     Error: global leak detected: settings
      at Runner.checkGlobals (/opt/node-0.10.3/lib/node_modules/mocha/lib/runner.js:177:21)
      at Runner.<anonymous> (/opt/node-0.10.3/lib/node_modules/mocha/lib/runner.js:58:44)
      at Runner.EventEmitter.emit (events.js:95:17)
      at /opt/node-0.10.3/lib/node_modules/mocha/lib/runner.js:248:12
      at Hook.Runnable.run (/opt/node-0.10.3/lib/node_modules/mocha/lib/runnable.js:215:5)
      at next (/opt/node-0.10.3/lib/node_modules/mocha/lib/runner.js:243:10)
      at Object._onImmediate (/opt/node-0.10.3/lib/node_modules/mocha/lib/runner.js:254:5)
      at processImmediate [as _immediateCallback] (timers.js:317:15)

can anyone explain this?

cheers
michael

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant