computmaxer / karma-jspm

Other
74 stars 50 forks source link

Fix for working with systemjs 0.17+ without getting 404s #67

Closed omerts closed 9 years ago

omerts commented 9 years ago

Not sure if it is the best way of approaching the issue. The issue: The jspm's config.js file was being loaded after the adapter.js file. Therefore, overriding the adapter's baseURL setting (baseURL: 'base'). On the other hand, making config.js load before adapter.js, doesn't work since as of SystemJs 0.17, you can't set baseURL twice. I am not getting into why it worked when config.js was actually setting baseURL a second time.

The solution: Instead of setting the configuration twice, once via config.js, and once via adapter.js. We are passing the configuration on to adapter.js, which in turn, injects the correct baseURL into the configuration. After injecting the correct baseURL, we are setting the configuration on SystemJS.

timkindberg commented 9 years ago

So my coworker tried this out and said:

Well, i didn't get the 404 error but I'm still not getting the transpiler to run. So yay on the 404 error but boo on parse errors for lack of transpilation.

Are you using jspm beta with typescript?

omerts commented 9 years ago

I am using jspm beta wit babel as a karma preprocessor. On Jul 8, 2015 10:40 PM, "Tim Kindberg" notifications@github.com wrote:

So my coworker tried this out and said:

Well, i didn't get the 404 error but I'm still not getting the transpiler to run. So yay on the 404 error but boo on parse errors for lack of transpilation.

Are you using jspm beta with typescript?

— Reply to this email directly or view it on GitHub https://github.com/Workiva/karma-jspm/pull/67#issuecomment-119709089.

timkindberg commented 9 years ago

Ok so perhaps this will not work with TypeScript. So for my team personally it may still be a blocker. Not sure if you'd have a chance to look into that as well, if not I understand.

omerts commented 9 years ago

@timkindberg have you tried: https://www.npmjs.com/package/karma-typescript-preprocessor

thoreinstein commented 9 years ago

I've been working with @timkindberg on this. We finally have everything working while using the code in this pull request. From my point of view this is good to go.

timkindberg commented 9 years ago

Well it worked for Babel, but not TypeScript.

ghost commented 9 years ago

@omerts Can you update your fork & this PR using the 2.0 beta branch?

Seems @jayudey-wf is inactive atm.

Fix the 404s please!

jayudey-wf commented 9 years ago

@robertbaker you have failing unit tests currently

ghost commented 9 years ago

@jayudey-wf I'm looking into using karma-systemjs. The downside is I have to manually reference my jspm packages, but that doesn't seem to have the 404 issues, so I'm trying that. I need to get my unit tests working today.

Question: Since karma-systemjs exists, would rewriting this plugin to just extend that plugin and enhance it with just jspm stuff needed be a better alternative?

omerts commented 9 years ago

@robertbaker I will try to get to it later today

@jayudey-wf failing unit tests are bcs I changed the way the jspm config is loaded. I didn't get to fixing the unit tests. They are basically still checking the old config loading.

omerts commented 9 years ago

@jayudey-wf Merged with tag 2.0.1 beta, and fixed ut. Do you want me to merge with master?

ghost commented 9 years ago

@omerts thanks. I'm using

/
--/.build/config.js
--/.build/jspm_packages/

My compiled ts is in /.build/app/*/.js

My tests are in /src/app/*/.spec.js

Your fix fixed the 404's.

Although I needed proxies.

        proxies: {
            '/base/src/app': '/base/.build/app',
            '/base/jspm_packages': '/base/.build/jspm_packages',
            '/base/app/src/app': '/base/src/app',
            '/base/app': '/base/.build/app'
        },
maxwellpeterson-wf commented 9 years ago

@omerts I believe this should be fixed with the merge of #84. Can you confirm? If not I can reopen this PR.