nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

setUp and tearDown do not appear to work in the browser

Open bcronin opened this issue 12 years ago • 1 comments

Steps to reproduce:

  1. Go into the examples/browser folder
  2. Open test.html
  3. Everything works as expected
  4. Add setUp and tearDown functions to suite1.js
  5. Refresh the page to rerun the tests

Defect: the functions added in step 4 are run just like normal tests

This appears to be a defect in the copy of nodeunit.js in the examples/browser folder. The example's version of nodeunit.js has a function wrapGroup but this is never called; whereas the node-based nodeunit.js in lib/core.js does call this.

(Sorry that I don't understand the code base well enough at the moment to offer a patch.)

bcronin avatar Jun 16 '13 16:06 bcronin

Here's a copy+paste fix for broken setUp and tearDown methods in the examples version of nodeunit:

  • replace the following functions in examples/nodeunit.js with the corresponding versions from the lib/core.js file:
    • exports.runModule()
    • wrapGroup()
    • exports.runModule()
  • copy the getSerialCallback() function from lib/core.js and paste into examples/nodeunit.js, just before the wrapGroup() function.

https://gist.github.com/dfkaye/9280921

dfkaye avatar Feb 28 '14 22:02 dfkaye