computmaxer / karma-jspm

Other
74 stars 52 forks source link

404: /base/jspm_packages/npm/@angular/core@2.0.0-rc.6/testing.js #177

Closed chendachao closed 7 years ago

chendachao commented 7 years ago

When I upgrade angular to rc 6, it throws this kind of error:

 404: /base/jspm_packages/npm/@angular/core@2.0.0-rc.6/testing.js
12 09 2016 19:15:10.989:WARN [web-server]: 404: /base/jspm_packages/npm/@angular/platform-browser-dynamic@2.0.0-rc.6/testing.js
Chrome 53.0.2785 (Windows 10 0.0.0) ERROR: 'Potentially unhandled rejection [4] (SystemJS) XHR error (404 Not Found) loading http://localhost:9876/base/jspm_packages/npm/@angular/core@2.0.0-rc.6/testing.js
    Error: XHR error (404 Not Found) loading http://localhost:9876/base/jspm_packages/npm/@angular/core@2.0.0-rc.6/testing.js
    Error loading http://localhost:9876/base/jspm_packages/npm/@angular/core@2.0.0-rc.6/testing.js'
patrickmichalina commented 7 years ago

Same issue here on Angular 2.0.1

Error: (SystemJS) XHR error (404 Not Found) loading jspm_packages/npm/@angular/core@2.0.1/testing.js
        Error: XHR error (404 Not Found) loading jspm_packages/npm/@angular/core@2.0.1/testing.js
        Error loading jspm_packages/npm/@angular/core@2.0.1/testing.js as "@angular/core/testing" from app/components/my-comp/my-comp.component.spec.ts
crtormen commented 7 years ago

I'm blocked in the same situation. But I think I'm a step further. If you look at ...npm/@angular/core, doesn't exist a testing.js, but a testing folder. Angular testing was moved from @angular/testing to @angular/core/testing. So I put a package entry in my config.js:

"@angular/core/testing": { "main": 'index.js', 'defaultExtension': 'js' }

Assuming that @angular is been mapped correctly in map. Which im my case is

"@angular": "node_modules/@angular"

cause I installed @angular directly from npm.

But the problem keeps occurring:

WARN [web-server]: 404: /node_modules/@angular/core/testing/index.js Chrome 52.0.2743 (Linux 0.0.0) ERROR Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:9876/node_modules/@angular/core/testing/index.js Error loading http://localhost:9876/node_modules/@angular/core/testing/index.js as "@angular/core/testing" from http://localhost:9876/dist/src/app/app.spec.js

Anyone have some JSPM + Karma + Angular 2 example?

chendachao commented 7 years ago

@crtormen you can take a look at this one https://github.com/FountainJS/generator-fountain-angular2

lmaze commented 7 years ago

@crtormen There is also this seed example : https://github.com/UIUXEngineering/angular2-jspm-typescript-seed

I use this fork (https://github.com/UIUXEngineering/karma-jspm) that looks better maintained and all is working well with the latest version of Angular 2.

patrickmichalina commented 7 years ago

@chendachao please point out why this is related... I don't see anything in that repo related to this issue.

@crtormen I tried this one as well, still a no-go.

jerryorta-dev commented 7 years ago

I'm the author of https://github.com/UIUXEngineering/angular2-jspm-typescript-seed and https://github.com/UIUXEngineering/karma-jspm.

I could never load the angular 2 test files directly, but rather had to use the ".umd.js" files that are built -- See https://github.com/juliemr/ng2-test-seed/blob/master/karma-test-shim.js#L39.

In the https://github.com/UIUXEngineering/angular2-jspm-typescript-seed I'm creating a temporary jspm.karma.config.js that maps the umd files. This file is created upon running test tasks. It's not pretty, and I wish this does not have to be done. But I have also read that Angular was going to intentionally black box internal code to mitigate bugs and keep the api the same. I want to desperately have this work as described in this issue -- to no avail yet.

I don't like using the the .umd.js files by default because of code bloat -- what's the purpose of jspm then ( IMO )?

Hope this helps coming to a resolution.

chendachao commented 7 years ago

@patrickmichalina you can go to this repo https://github.com/FountainJS/generator-fountain-angular2 and see how to create a seed project with yeoman.

chendachao commented 7 years ago

Seems they have resolved our problem except code coverage.