Comments (9)
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?
from angular2-toaster.
Yes I am doing both of those... my suspicion is that maybe my mapping is wrong. I'll play around with that some more.
from angular2-toaster.
here is my System.config in my test.main.js
System.config({
baseURL: '/base/',
defaultJSExtensions: true,
paths: {
'angular2/*': 'node_modules/angular2/*.js',
'rxjs/*': 'node_modules/rxjs/*.js'
},
map: {
'angular2-toaster': 'node_modules/angular2-toaster'
}
});
That looks right doesn't it?
from angular2-toaster.
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?
from angular2-toaster.
I haven't verified loading order yet. Your suspicion sounds reasonable though. I'll take a look into that.
from angular2-toaster.
If there's anything I can do to help track it down, please feel free to let me know :)
from angular2-toaster.
@Stabzs I got things working.... not super happy about what I ended up with, tho, I will post again tonight with more details
from angular2-toaster.
to get my tests running, I had to add
{ pattern: 'node_modules/angular2-toaster/angular2-toaster.js', included: false },
{ pattern: 'node_modules/angular2-toaster/lib/*.js', included: false },
to the files
section of my karma configuration file.
Then, in test-main.js
I had to modify System.config
to add path for angular2-toastr and map it.
System.config({
baseURL: '/base/',
defaultJSExtensions: true,
paths: {
'angular2/*': 'node_modules/angular2/*.js',
'rxjs/*': 'node_modules/rxjs/*.js',
'angular2-toaster/*': 'node_modules/angular2-toaster/lib/*.js'
},
map: {
'angular2-toaster': 'node_modules/angular2-toaster'
}
});
Then in the same file, I had to import it using System.import
Promise.all([
System.import('angular2/src/platform/browser/browser_adapter'),
System.import('angular2/platform/testing/browser'),
System.import('angular2/testing'),
System.import('angular2-toaster/angular2-toaster')
])
from angular2-toaster.
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.
from angular2-toaster.
Related Issues (20)
- Extend peer dependencies to Angular 9 HOT 1
- Not woring on angular 8 ssr(server side rendering) HOT 1
- Angular 9 Angular Dependency Injection issue HOT 2
- Error with Angular 9 HOT 3
- Can't upgrade to Angular 10 HOT 6
- Extend peer dependencies to Angular 10 HOT 1
- Angular 10 - 'ModuleWithProviders<T>' requires 1 type argument(s) HOT 2
- How to add containerId in ToasterConfig? HOT 3
- Typing error in build for Angular 11 HOT 5
- Cannot target which container to show toast in HOT 1
- Duplicated Nested Close Buttons after update HOT 2
- Angular Universal SSR support request HOT 4
- Warning: Can't resolve all parameters for ToasterConfig HOT 2
- New release for Angular 13 ? HOT 7
- 'toaster-container' is not a known element
- Thoughts of renaming the css class by adding prefix e.g. ng2- HOT 1
- Angular 15 seems not suported HOT 1
- Not working in angular 16.0 HOT 2
- Angular v17 support
- Angular v14 support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-toaster.