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

How to tell QUnit to execute tests wrapped in AMD definition ? #31

Closed
toranb opened this issue Apr 3, 2014 · 3 comments
Closed

How to tell QUnit to execute tests wrapped in AMD definition ? #31

toranb opened this issue Apr 3, 2014 · 3 comments

Comments

@toranb
Copy link

toranb commented Apr 3, 2014

I closed the issue I opened earlier because it all boils down to this 1 issue

With karma/testem/qunit in browser - how do I force the test runner to execute a transpiled amd module? My test is very simple (including a simple import for my person model in this example), but karma never executes the specs inside the module.

Any help would be really appreciated

define("js/tests/unit/unit_tests", 
  ["js/models/person"],
  function(__dependency1__) {
    "use strict";
    var Person = __dependency1__["default"];

    test('selects first tab and shows the panel', function() {
      expect(1);
      equal(1, 1);
    });
  });
@ryanflorence
Copy link
Contributor

Karma has config options for AMD and requirejs, if you're using named AMD (heaven help us) then you need to drop in your loader to. This is all karma stuff though, not ember-qunit so I'm closing. Ping me tomorrow and I can point you to some things.

@toranb
Copy link
Author

toranb commented Apr 3, 2014

Thanks for the quick reply @rpflorence

For anyone that follows, this simple loader runs my above test for both qunit and karma

require("js/tests/unit/unit_tests", null, null, true);

@toranb
Copy link
Author

toranb commented Apr 3, 2014

I finally got a full blown working example of this on github (including unit and integration tests side-by-side). requires the manual qunit setup currently (bug in the es6 transpiler + karma that will be fixed in the next es6-transpiler release)

https://github.com/toranb/ember-grunt-example

And here was the (very simplified eak-lite test loader that works for all the unit tests)

Ember.keys(requirejs._eak_seen).filter(function(key) {
  return (/\unit/).test(key);
}).forEach(function(moduleName) {
  require(moduleName, null, null, true);
});

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

2 participants