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

Feature/cjsify sinon sandbox tests #1088

Merged

Conversation

jonnyreeves
Copy link
Contributor

@jonnyreeves jonnyreeves commented Jul 8, 2016

Remove sinon.* references from sandbox and its test suite! 🚀

This PR represents the last "core" sinonJS module that needed to be migrated 🎉 There were a few of minor casualties in the test-suite, namely 3 tests around the deprecated(?) sandbox.useFakeXMLHttpRequest() API (which just call through to the useFakeServer() API anyway...)

Removes all `sinon.*` references from the test suite bar the fakes.
Had to skip a couple of tests were were testing the implementation of lolex.
@jonnyreeves jonnyreeves mentioned this pull request Jul 8, 2016
36 tasks
});

it("passes arguments to sinon.useFakeTimers", function () {
var stub = sinon.stub(sinon, "useFakeTimers").returns({ restore: function () {} });
// Not sure how we can test this without monkey-patching or testing the implementation of lolex.
Copy link
Member

Choose a reason for hiding this comment

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

What is the problem with the commented out code? Looks like that should do ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I stubbed useFakeTimers it cause a bunch of assertion failures in other modules, almost as if the clock stub was not being restored. Let me try it again and see if I can get to the root of that issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

There have been a few fixes in lolex related to Date and timers recently, so maybe try upgrading to 1.5.1 and see if that helps? I could also help out if you are short on time.

@jonnyreeves jonnyreeves self-assigned this Jul 11, 2016
@jonnyreeves jonnyreeves force-pushed the feature/cjsify-sinon-sandbox-tests branch 2 times, most recently from ec19f89 to 655661b Compare July 27, 2016 21:00
Pretty straight forward, removed 3 tests which were focused around the deprecated `sandbox.useFakeXMLHttpRequest()` API, the comment above them implied they were flakey anyway...
@jonnyreeves jonnyreeves force-pushed the feature/cjsify-sinon-sandbox-tests branch from 655661b to 7a90c5f Compare July 27, 2016 21:02
@jonnyreeves
Copy link
Contributor Author

@fatso83, @mantoni managed to resolve this by simply using a stub instead of a spy; before doing this I tried installing 1.5.0 of lollex (which didn't help) and I rewrote the 2 failing fake-timers-tests to cache window.setTimeout before the suite ran (this fixed the issue, but I have no idea why!)

My hope is that this kind of weird flakiness falls out from the suite once the last of the modules are cjsified... :)

@fatso83
Copy link
Contributor

fatso83 commented Jul 27, 2016

LGTM

@mantoni
Copy link
Member

mantoni commented Jul 27, 2016

🚢

@jonnyreeves jonnyreeves merged commit 2604d99 into sinonjs:master Jul 27, 2016
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

Successfully merging this pull request may close these issues.

3 participants