I have a web app written in Coffeescript that I'm testing with nodeunit, and I can't seem to get access to global variables ("session" vars in the app) set in the test:
src/test.coffee
root = exports ? this
this.test_exports = ->
console.log root.export
root.export
test/test.coffee
exports["test"] = (test) ->
exports.export = "test"
test.equal test_file.test_exports(), "test"
test.done()
Results in output:
test.coffee
undefined
✖ test
AssertionError: undefined == 'test'
How do I access globals across tests?
You can share global state using the "global" object.
one.coffee:
two.coffee:
Load each one from a third module (an interactive session in this example)