-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Conversation
Fixed, @filipesilva review please. |
35c8f2c
to
e9fea60
Compare
}) | ||
.then(__karma__.start, __karma__.error); | ||
System.import('@angular/core/testing') | ||
.then(function (coreTesting) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you separate these into a similar setup as before? It's usually nicer to see:
System.import('systemjs.config.js')
.then(() => Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]))
.then((providers) => {
var coreTesting = providers[0];
var browserTesting = providers[1];
coreTesting.TestBed.initTestEnvironment(
browserTesting.BrowserDynamicTestingModule,
browserTesting.platformBrowserDynamicTesting());
})
.then(function () {
// Finally, load all spec files.
// This will run the tests directly.
return Promise.all(
allSpecFiles.map(function (moduleName) {
return System.import(moduleName);
}));
})
.then(__karma__.start, __karma__.error);
Have that nit, otherswise LGTM. |
Changed that. |
I was about to report an issue that the karma tests don't work, but then I saw your changes here, and I integrated them into my workspace. However, I'm still getting failures when I run npm test from part 1 of Tour of Heroes tutorial, The Hero Editor. I created a new repo for QuickStart:
And npm test runs correctly. However, once I add the files from part 1 of the Tour-of-Heroes, the tests fail.
|
Found a solution! To app.component.ts, I added at the top:
and within
Can you please update the part 1 page of the tutorial? |
@psnider I would avoid that solution, because afaik it will not work in the near future. Instead, what you should do is configure the testing module to import the
|
I couldn't get this to work. I modified app.component.spec.ts:
and
What am I missing? and here's the first part of the new error:
|
Well the testing module is like a normal module, right? So let's look at the toh-1
Basically,
Not too sure why the |
Thanks so much, I'm paying close attention to testing, and want to make sure that all of the tests run at the end of each part of the tutorial. FWIW, the testing support you have with the QuickStart and tutorial is very valuable to me. |
What bits of it make it a struggle, specifically? |
The bits that make it a struggle
DetailsTrying to configure karma and systemjs has been very difficult. karma The karma configuration seems to be much more complex than what is described in http://karma-runner.github.io/1.0/config/configuration-file.html and http://karma-runner.github.io/1.0/config/files.html. systemjs karma and system.js together with angular Another point of confusion is that the same symbol names are used for many things. changing the project directory structure |
Heya @psnider, we have a revised and very complete Testing guide at https://angular.io/docs/ts/latest/guide/testing.html#!#setup-files. It doesn't answer all of difficulties, but I think it answers most of them. |
@psnider I wince as I read your perfectly reasonable questions. Our testing guide does not yet cover re-configuration of karma and systemjs for a different project structure. It's on our backlog. Your questions here are helpful and will inform our effort to take this necessary next step. What should you do for now? Ah ... I'll be back ;-) |
@filipesilva @wardbell Now I'm only missing one thing:
I'd greatly appreciate you keeping me up to date with any improvements to the karma documentation! Please feel free to comment directly on my project, if you like. |
NOT to merge until angular/zone.js#404 is fixed.