webpro / Automated-SPA-Testing

Automated unit & functional testing for web applications
106 stars 12 forks source link

Intern, alternate AMD loaders, and non-AMD code #3

Closed csnover closed 11 years ago

csnover commented 11 years ago

Hi,

Just an FYI that Intern is not prescriptive about which AMD loader you use as long as it supports the map common configuration option. If you have used specific functionality provided by another loader, like shim in RequireJS or Promises-based loader APIs in curl.js, you can simply replace the loader in client.html/client.js. If there is a lot of demand for using alternative AMD loaders, we could certainly turn this into a configuration option, but for now the necessary modifications are quite trivial.

Problems loading non-AMD code in software built using AMD is not unique to Intern; curl.js follows the same approach that Intern does with regards to loading legacy scripts—namely, the use of a separate plugin. Intern absolutely does support loading non-AMD code.

All the best,

webpro commented 11 years ago

Thanks for your feedback, @csnover. I understand what you're saying, I actually tried to get things running (in here), but to no avail because of (I now realize) the actual issue, having something to do with the exported has function and require.has being undefined when using require.js:

screenshot

I must add that the way non-AMD stuff is written down may sound like "require.js is doing it right, and Intern is doing it wrong", which is not the case and not how it should come across. There's clearly no standard here, but I just happen to have a preference to be able to configure non-AMD code in one, central place (and for some it's not easy to switch the loader). So, for existing projects that might be looking into adopting Intern, a "BYOL" approach would make things much more attractive (so many projects using require.js).

Will dive into the error later, and also update the content.

csnover commented 11 years ago

The crash you’ve described is fixed in master and will be fixed in Intern 1.2. :)

webpro commented 11 years ago

Thanks for the ping @csnover! I actually have a very basic, but working example using require.js: https://github.com/webpro/baseplate/tree/master/test/intern. Let me know when 1.2 is out and I'll update things.

csnover commented 11 years ago

1.2 is out.

webpro commented 11 years ago

Thanks, @csnover.

How about using an alternative loader when running tests in Node? Do you know if that should work at all, or maybe know about projects that have it running?

csnover commented 11 years ago

It should work with client.js. It will not work with runner.js, at the moment.

webpro commented 11 years ago

Closing this for now. Feel free to re-open or open a new ticket.

csnover commented 10 years ago

Another FYI, support for alternative loaders has been significantly improved in Intern 1.3, along with code coverage on the command-line. I believe this fully addresses your complains as listed in the README. Please let me know if there are any new ones.

webpro commented 10 years ago

@csnover, thanks for the update. I'm still not getting Intern to work in https://github.com/webpro/baseplate. Any change you'd submit a PR with something working from /test/intern? I would love to try out Intern and see what it's in there. And I'd be more than happy to update this page accordingly.

webpro commented 10 years ago

Updated the docs (and included Intern in comparison table).