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

Stubbing requirejs #26

Closed
johlrogge opened this issue Dec 14, 2011 · 8 comments
Closed

Stubbing requirejs #26

johlrogge opened this issue Dec 14, 2011 · 8 comments

Comments

@johlrogge
Copy link

Just thought of a complimentary approach to the one described in #15.

If there was a requirejs extension for buster that would do this:

  1. create two functions in global scope
    • define(deps, body)
    • require(deps, body)

Then buster has full control over which modules are loaded and could if necessary rewrite paths etc. Internally it would probably be wise to delegate to requirejs somehow since requirejs has a lot of plugins and stuff that would be a pain to emulate properly (I guess...). The merits of this approach I think is:

  1. buster would know when everything is loaded since it is in the drivers seat
  2. buster could allow the testwriter to declare something different than the real thing to be returned for a named module

buster.moduleStubs({"server/queue", function(element) {...emulate queue...}});

Totally insane?

@augustl
Copy link
Member

augustl commented Dec 14, 2011

Afaik Chris has a buster-requirejs module planned, that'll probably do pretty much what you suggest here. We don't want it in "core" buster, but it will be easy to simply install the module and load it in the config file.

@johlrogge
Copy link
Author

Not surprisingly you guys are way ahead of me:) Awesome.

Meanwhile I'll get more familiar with buster in other areas. The path-issue is a bit of a blocker for me right now so I might as well explore a bit.
I would like to chip in on the AMD-stuff if possible but in order to not slow you guys down with silly questions I'll browse around a bit and get a better feeling for buster as a whole.

@augustl
Copy link
Member

augustl commented Dec 14, 2011

So far, development of buster has been fairly closed. Most of the work is done in private discussions, in norwegian, directly between Chris and myself.. From now on it'll all be in english and CC-ed to http://groups.google.com/group/busterjs-dev so that'll hopefully make "outsiders" feel more welcome. Many things are still just in our heads though, especially buster-capture-server and buster-test related stuff.

Tobias Ebnöther (ebi on IRC) is currently working on a test coverage module, which is pretty much a standalone extension that uses our existing extension APIs. So since the requirejs stuff is also an extension, it's probably not that far fetched for you to start working on a buster-requirejs extension. Come join us on IRC if you aren't already there, or e-mail busterjs-dev@googlegroups.com, and we'll help in any way we can.

@cjohansen
Copy link
Member

I really like the idea of the module stubs. Hadn't thought of that.

@johlrogge
Copy link
Author

Im glad you like it!

I've been using amd modules for a few weeks and this is one of the things i
wanted to be able to do.

I hope i will be up to speed with buster fast enough to help out with what
little i have learned about working with amd. It seems to me from what i
learned about node testing yesterday that with this extension node testing
and browsertesting could be made to look exactly the same if desired. (if
you use amd for the browser).

Great fun!
On Dec 14, 2011 11:47 PM, "Christian Johansen" <
reply@reply.github.com>
wrote:

I really like the idea of the module stubs. Hadn't thought of that.


Reply to this email directly or view it on GitHub:
#26 (comment)

@augustl
Copy link
Member

augustl commented Mar 10, 2012

Do we close this issue? Or should we build support for module stubs as well as buster-amd from #15?

@cjohansen
Copy link
Member

Should probably live in buster-amd, I agree.

@augustl
Copy link
Member

augustl commented Mar 12, 2012

Closing, then. The more stuff we can get into #15 the better :D

@augustl augustl closed this as completed Mar 12, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants