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

Commonjs-ified sinon.spy #920

Merged
merged 6 commits into from
Nov 23, 2015
Merged

Commonjs-ified sinon.spy #920

merged 6 commits into from
Nov 23, 2015

Conversation

fearphage
Copy link
Member

Updated sinon.spy to make use of cjs'd modules and to export itself using commonjs styling.

Notable changes

  • moved sinon.format to core in the process. Core seems like a placeholder that will one day go away
  • sinon.spyCall is exposed solely for testing (both uses of it internally are commonjs-fied)
  • Due to a few tests, I could not remove the sinon/core include from spy (related to sinon.format)

@@ -14,6 +14,8 @@ module.exports = exports = require("./sinon/util/core");

exports.extend = require("./sinon/extend");
exports.match = match;
exports.spy = require("./sinon/spy");
exports.spyCall = require("./sinon/call");
Copy link
Member Author

Choose a reason for hiding this comment

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

Exposed solely for testing purposes? It seems like an internal tool only though.

Copy link
Member

Choose a reason for hiding this comment

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

I think this was used internally. I think it can be removed since it would be released with a major. @cjohansen do you recall?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a part of the external API at least.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's exposed publicly, because that's how it is tested (see call-test.js).

@fearphage fearphage closed this Nov 11, 2015
@fearphage fearphage reopened this Nov 11, 2015
@fearphage
Copy link
Member Author

Just rerunning the tests. 😉

@mroderick
Copy link
Member

@fearphage this is a very nice pull request. I love how easy it is to follow along, when there are separate commits for each step. 👍

@fearphage
Copy link
Member Author

@mroderick Thank you. I appreciate it.

@mantoni
Copy link
Member

mantoni commented Nov 16, 2015

Very nice, indeed. Are you intending to clear up the "format coupling" within this pull request or is this going to happen separately?

@fearphage
Copy link
Member Author

I think the tests need to be refactored in a big way to fix the call+format tests. I think this code is good to merge. I wasn't planning on decoupling them in this PR. I'm always open to suggestions though.

@fearphage
Copy link
Member Author

So what's the word, folks?

@fatso83
Copy link
Contributor

fatso83 commented Nov 23, 2015

Sorry for keeping you waiting. Very nice work, indeed.

fatso83 added a commit that referenced this pull request Nov 23, 2015
@fatso83 fatso83 merged commit 0621f1e into sinonjs:master Nov 23, 2015
@fearphage
Copy link
Member Author

FYI, you can now import this separately from everything else.

$ node
> var foo = require('sinon/lib/sinon/spy')();
> foo.callCount
1

I haven't used it, but I know it can be included at least. I was wondering if anyone considered pulling out the separate pieces into different repos or at least different npm targets. Imagine npm install sinon-spy. Just something to think about.

Thanks everyone.

@fearphage fearphage deleted the cjs-spy branch November 23, 2015 21:29
@cjohansen
Copy link
Contributor

Awesome! That's definitely something I've thought about more than once.

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.

5 participants