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

Add a property-namespacing-like replace strategy for browsers. #55

Closed
searls opened this issue Nov 25, 2015 · 1 comment
Closed

Add a property-namespacing-like replace strategy for browsers. #55

searls opened this issue Nov 25, 2015 · 1 comment

Comments

@searls
Copy link
Member

searls commented Nov 25, 2015

Of course, td.replace() only works in Node.js, because quibble is coupled to Node's Module module. However, what if instead of throwing an error, the behavior was changed for browsers?

For instance:

var property = td.replace(some.object, 'property')

property // a test double created with the same rules as td.replace() for node

td.reset() // will restore all the replaced stuff

I like this a lot because it would increase the utility of testdouble.js on projects without marrying us to a module scheme. Conceivably, somebody could build a plugin using this as a primitive to add support for AMD or what-not.

Downsides to using the same td.replace name include possible confusion, however, since the behavior will be so different. I'm sure we could implement it without issue b/c browserify will load a different file, but I'm worried about the risk of confusion to users who might see a snippet or doc in one place which doesn't apply to the context they're using td.js in. JavaScript is hard.

@searls
Copy link
Member Author

searls commented Nov 30, 2015

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

No branches or pull requests

1 participant