-
Notifications
You must be signed in to change notification settings - Fork 95
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
ReferenceError: Can't find variable: exports - karma #12
Comments
Are you loading `'node_modules/traceur/bin/traceur-runtime.js', // Required by PhantomJS2, otherwise it shouts ReferenceError: Can't find variable: require' before attempting to load angular2-toaster? Also, are you mapping it at all in your systemjs configuration? |
Yes I am doing both of those... my suspicion is that maybe my mapping is wrong. I'll play around with that some more. |
here is my System.config in my test.main.js
That looks right doesn't it? |
Yes, the mapping looks correct. In hindsight, I do remember having a lot of issues implementing the karma test runner. Note that the https://github.com/Stabzs/Angular2-Toaster/blob/master/karma-test-shim.js used is a bit different from what is used in the seed. If you follow it, something like Promise.all([
System.import('angular2/src/platform/browser/browser_adapter'),
System.import('angular2/platform/testing/browser'),
System.import('angular2/testing')
System.import('angular2-toaster')
]). might be necessary. In this case, I suspect that angular2-toaster is loading before traceur is loaded to properly polyfill export. Have you verified loading order? |
I haven't verified loading order yet. Your suspicion sounds reasonable though. I'll take a look into that. |
If there's anything I can do to help track it down, please feel free to let me know :) |
@Stabzs I got things working.... not super happy about what I ended up with, tho, I will post again tonight with more details |
to get my tests running, I had to add
to the Then, in
Then in the same file, I had to import it using
|
Thanks for the details and perseverance on this issue. I'm not certain if there's a better way to structure this or if the library could make this type of testing easier. I'm open to suggestions but I'll be closing the issue for now since I don't think it's necessarily something the library is doing incorrectly. |
I'm getting this error when I am running my tests. I am using angular2-seed.
When running
npm test
I was initially getting:404: /base/angular2-toaster/angular2-toaster.js
That issue was easily fixed by adding
'node_modules/angular2-toaster/angular2-toaster.js'
to mykarma.conf.js
file.After adding that, I began getting the error
ReferenceError: Can't find variable: exports
The text was updated successfully, but these errors were encountered: