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

Make test registration asynchronous #22

Closed
jvilk opened this issue May 13, 2013 · 2 comments
Closed

Make test registration asynchronous #22

jvilk opened this issue May 13, 2013 · 2 comments

Comments

@jvilk
Copy link
Owner

jvilk commented May 13, 2013

OK, tests are launched properly now, but they are registered on page load.

If we can figure out how to register tests asynchronously, then we can trigger test registration after loading in any test files for #19.

Right now, the issue is that Karma's Jasmine adapter appears to trigger Jasmine tests once page load finishes. I wonder if there is a way to trigger it manually?

@jvilk
Copy link
Owner Author

jvilk commented May 13, 2013

It looks like window.__karma__.start is the generic function that Karma automatically triggers which kicks off unit tests.

https://github.com/karma-runner/karma-jasmine/blob/master/src/adapter.wrapper#L6

@jvilk
Copy link
Owner Author

jvilk commented May 13, 2013

I figured it out.

We need to pretend that we're using RequireJS. This prevents Karma from triggering the tests until we explicitly run __karma__.start().

One issue: We won't be able to use require in the tests. But since we batch require in the test setup function, we're good. 😄

@jvilk jvilk closed this as completed in 5454a8c May 13, 2013
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