Closed ghost closed 9 years ago
I'll check this out now and see what I can do.
This is not a 100% complete solution but it may get you close enough... hopefully. https://github.com/robertbaker/system-unit-test/compare/master...maxwellpeterson-wf:layout2?expand=1
First I changed the jspm config so that packages are not under .build
. It is easier if we don't have to override the baseURL setting, and jspm_packages
and config.js
should be fine in the root directory. Strangely this alone didn't work, I had to rename .build
to build
for karma to request the paths properly with a preceding /base/
.
Next I had to include angular
and angular-mocks
in the karma files, as you were referencing them as global in your tests.
Next I added the copy:tests
task to run on test
. This will put your specs right next to the compile JS files that it should be testing. Updated the karma config to load the specs from build/
instead of src/
.
At this point the tests run but fail because the controller you are attempting to test hasn't been loaded. I attempted to import the login file with both import './login';
and require('./login');
but it doesn't seem like that alone is going to be what is needed. I don't have a lot of experience testing AngularJS apps, maybe you will know what to do from this point?
@maxwellpeterson-wf thank you for checking this out. I'll look at this later today and get back to you.
Hello, for the past month I been trying to get unit tests to run with either karma-jspm or karma-systemjs.
I have created a bare bones repo for you to test and help get them running.
In the karma.config you will see 2 configurations. One for karma-jspm and one for karma-systemjs. Please comment/uncomment the appropiate configuration.
I would really appreciate the team taking their time and trying to get them to run. I'm pulling out my har, I really need to get my units tests running again.
The repo contains 2 layouts. They differ by baseURL.
Layout 1 uses plugin-typescript, with a baseURL of "/"
Layout 2 is what I'm using in my project now. The typescript is transpiled into /.build/app the jspm_packages and config live in .build.
The only thing I care about is to get the unit tests to run. If that means you need to rearrange things, go ahead.
The test repo: https://github.com/robertbaker/system-unit-test