Skip to content
This repository has been archived by the owner on Mar 28, 2018. It is now read-only.

Inject sinon sandbox in the current module before the QUnit module's setup()` method is invoked. #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jonnyreeves
Copy link

This allows the developer to initiate their stubs, mocks and spies in the setup method, safe in the knowledge that they will be automatically reset between each test.

I had trouble getting the jsTestDriver unit tests to work (and wasn't 100% sure what coverage I should be adding!)

…s `setup()` method is invoked.

This allows the developer to initiate their stubs, mocks and spies in the setup method, safe in the knowledge that they will be automatically reset between each test.
@cjohansen
Copy link
Owner

To run the JsTestDriver tests:

  • Download JsTestDriver
  • Start the server: java -jar JsTestDriver-1.3.5.jar --port 4224
  • Capture browser
  • Run tests: cd path/to/sinon-qunit && java -jar JsTestDriver-1.3.5.jar --tests all

You should add a test using setup/teardown to demonstrate that this works.

@jonnyreeves
Copy link
Author

Any thoughts on this?

@JeffFaer
Copy link

👍

activeSandbox = sinon.sandbox.create(sandboxConfig);

// Restore the native setTimeout method as it's used internally by QUnit.
if (sinon.config.useFakeTimers) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to cause unexpected behavior, because Sinon will not work as advertised...

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

Successfully merging this pull request may close these issues.

3 participants