lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

404: /base/ionic-framework/ionic.js #22

Closed xr0master closed 8 years ago

xr0master commented 8 years ago

Hi, I did all like in your blog, but i have this issue:

28 02 2016 01:24:52.746:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#hTYdX_L5MLED92lqAAAA with id 16672709
PhantomJS 2.1.1 (Mac OS X 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'
28 02 2016 01:24:53.764:WARN [web-server]: 404: /base/ionic-framework/ionic.js
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR: 'http://localhost:9876/base/node_modules/systemjs/dist/system.src.js?281591da6090abed69cd0b080aa69c8de089a41c:733:14
run@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:1217:29
zoneBoundFn@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:1194:29
lib$es6$promise$$internal$$tryCatch@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:442:25
lib$es6$promise$$internal$$invokeCallback@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:454:53
lib$es6$promise$$internal$$publish@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:425:53
lib$es6$promise$$internal$$publishRejection@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:375:42
http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:97:12
run@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:1217:29
zoneBoundFn@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:1194:29
lib$es6$promise$asap$$flush@http://localhost:9876/base/node_modules/zone.js/dist/zone-microtask.js?87bbeaae4d01ebf513e1bbea41a0e13dbad92eb4:236:18'
28 02 2016 01:24:53.771:WARN [web-server]: 404: /base/ionic-framework/ionic.js
Finished in 0.002 secs / 0 secs
xr0master commented 8 years ago

Forgot added 'ionic/*': 'node_modules/ionic-framework/*.js', 'ionic-framework/*': 'node_modules/ionic-framework/*.js'

xr0master commented 8 years ago

Can you, please, help me added ionic-native to test too? I just don't understand, what is "karma config files" and "test main path"

lathonez commented 8 years ago

Hi,

I'm going to need a bit of info about your set up. Are you working on an ionic2 starter or are you importing the framework into an existing project?

In the latter case, is the project available on github so I can take a look and debug?

xr0master commented 8 years ago

Used ionic2 starter. I can push the project to github.

Pushed: https://github.com/xr0master/anyCuby

It would be very nice if you can look and debug this project. Thank you very much.

lathonez commented 8 years ago

Ahah, so you've included another node_module (ionic-native) which you're getting the 404 on?

You need to add ionic-native to karma.config.js. For full details see https://github.com/lathonez/clicker/issues/20.

For me adding the following two lines to karma.config.js works

x220:~/code/anyCuby$ git diff
diff --git a/test/karma.conf.js b/test/karma.conf.js
index 649efc8..df48d2d 100644
--- a/test/karma.conf.js
+++ b/test/karma.conf.js
@@ -31,6 +31,7 @@ module.exports = function(config) {
       { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
       { pattern: 'www/build/test/**/*.js', included: false, watched: true },
       { pattern: 'www/build/test/**/*.html', included: false, served: true},
+      { pattern: 'node_modules/ionic-native/dist/ionic.native.js', included: false, served: true},

       'test/test-main.js'
     ],
@@ -75,7 +76,8 @@ module.exports = function(config) {
     proxies: {
       '/base/node_modules/ionic-framework/decorators/app.js': '/base/www/build/test/app.stub.js', // stub out Ionic's @App decorator
       '/base/www/build/app': '/base/www/build/test',
-      '/build': '/base/www/build/test'
+      '/build': '/base/www/build/test',
+      '/base/ionic-native.js': '/base/node_modules/ionic-native/dist/ionic.native.js'
     },

     // level of logging
xr0master commented 8 years ago

Oh, so simple... I haven't words ) Very appreciative.

lathonez commented 8 years ago

No worries glad I could help

matiu commented 8 years ago

Sorry to comment on a closed ticket:

I followed the thread and tried to add angular-native to Karma. While the original 404 was solved, now I get:

9 04 2016 10:17:39.503:WARN [web-server]: 404: /base/ng1.js
19 04 2016 10:17:39.503:WARN [web-server]: 404: /base/plugins/actionsheet.js
19 04 2016 10:17:39.504:WARN [web-server]: 404: /base/plugins/appavailability.js
19 04 2016 10:17:39.504:WARN [web-server]: 404: /base/plugins/appversion.js
19 04 2016 10:17:39.505:WARN [web-server]: 404: /base/plugins/badge.js
19 04 2016 10:17:39.506:WARN [web-server]: 404: /base/plugins/barcodescanner.js
19 04 2016 10:17:39.506:WARN [web-server]: 404: /base/plugins/base64togallery.js
19 04 2016 10:17:39.507:WARN [web-server]: 404: /base/plugins/ble.js
19 04 2016 10:17:39.508:WARN [web-server]: 404: /base/plugins/calendar.js
19 04 2016 10:17:39.508:WARN [web-server]: 404: /base/plugins/camera.js
19 04 2016 10:17:39.508:WARN [web-server]: 404: /base/plugins/batterystatus.js
19 04 2016 10:17:39.509:WARN [web-server]: 404: /base/plugins/apprate.js
19 04 2016 10:17:39.510:WARN [web-server]: 404: /base/plugins/clipboard.js
19 04 2016 10:17:39.563:WARN [web-server]: 404: /base/plugins/contacts.js
19 04 2016 10:17:39.565:WARN [web-server]: 404: /base/plugins/datepicker.js
19 04 2016 10:17:39.566:WARN [web-server]: 404: /base/plugins/dbmeter.js
19 04 2016 10:17:39.567:WARN [web-server]: 404: /base/plugins/device.js
19 04 2016 10:17:39.567:WARN [web-server]: 404: /base/plugins/devicemotion.js
19 04 2016 10:17:39.568:WARN [web-server]: 404: /base/plugins/deviceorientation.js
19 04 2016 10:17:39.568:WARN [web-server]: 404: /base/plugins/facebook.js
19 04 2016 10:17:39.569:WARN [web-server]: 404: /base/plugins/file.js
19 04 2016 10:17:39.569:WARN [web-server]: 404: /base/plugins/diagnostic.js
19 04 2016 10:17:39.570:WARN [web-server]: 404: /base/plugins/dialogs.js
19 04 2016 10:17:39.571:WARN [web-server]: 404: /base/plugins/globalization.js
19 04 2016 10:17:39.571:WARN [web-server]: 404: /base/plugins/hotspot.js
19 04 2016 10:17:39.571:WARN [web-server]: 404: /base/plugins/imagepicker.js
19 04 2016 10:17:39.572:WARN [web-server]: 404: /base/plugins/flashlight.js
19 04 2016 10:17:39.572:WARN [web-server]: 404: /base/plugins/geolocation.js
19 04 2016 10:17:39.576:WARN [web-server]: 404: /base/plugins/keyboard.js
19 04 2016 10:17:39.577:WARN [web-server]: 404: /base/plugins/launchnavigator.js
19 04 2016 10:17:39.577:WARN [web-server]: 404: /base/plugins/localnotifications.js
19 04 2016 10:17:39.578:WARN [web-server]: 404: /base/plugins/network.js
19 04 2016 10:17:39.578:WARN [web-server]: 404: /base/plugins/inappbrowser.js
19 04 2016 10:17:39.580:WARN [web-server]: 404: /base/plugins/sms.js
19 04 2016 10:17:39.581:WARN [web-server]: 404: /base/plugins/socialsharing.js
19 04 2016 10:17:39.581:WARN [web-server]: 404: /base/plugins/spinnerdialog.js
19 04 2016 10:17:39.581:WARN [web-server]: 404: /base/plugins/splashscreen.js
19 04 2016 10:17:39.582:WARN [web-server]: 404: /base/plugins/push.js
19 04 2016 10:17:39.585:WARN [web-server]: 404: /base/plugins/toast.js
19 04 2016 10:17:39.585:WARN [web-server]: 404: /base/plugins/touchid.js
19 04 2016 10:17:39.586:WARN [web-server]: 404: /base/plugins/vibration.js
19 04 2016 10:17:39.588:WARN [web-server]: 404: /base/plugins/plugin.js
19 04 2016 10:17:39.588:WARN [web-server]: 404: /base/plugin.js
19 04 2016 10:17:39.589:WARN [web-server]: 404: /base/plugins/statusbar.js
19 04 2016 10:17:39.592:WARN [web-server]: 404: /util.js
19 04 2016 10:17:39.638:WARN [web-server]: 404: /base/Subscription.js
19 04 2016 10:17:39.639:WARN [web-server]: 404: /util/SymbolShim.js
19 04 2016 10:17:39.640:WARN [web-server]: 404: /base/root.js
19 04 2016 10:17:39.646:WARN [web-server]: 404: /base/node_modules/rxjs/util/tryOrOnError.js

I added

      // '/base/ng1.js': '/base/node_modules/ionic-native/dist/ng1.js',
      // '/base/plugin.js': '/base/node_modules/ionic-native/dist/plugins/plugin.js',
      // '/base/plugins/': '/base/node_modules/ionic-native/dist/plugins/',

to proxies and

      { pattern: 'node_modules/ionic-native/dist/**/*.js', included: false, served: true},

to `files.

It resolved some of the conflicts, BUT still there are a lot (10) 404.

19 04 2016 10:20:39.363:WARN [web-server]: 404: /util.js
19 04 2016 10:20:39.382:WARN [web-server]: 404: /base/Subscription.js
19 04 2016 10:20:39.383:WARN [web-server]: 404: /util/SymbolShim.js
19 04 2016 10:20:39.383:WARN [web-server]: 404: /base/root.js
19 04 2016 10:20:39.391:WARN [web-server]: 404: /base/node_modules/rxjs/util/tryOrOnError.js
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR: Error{stack: null, originalErr: Error{}, line: 821, sourceURL: 'http://localhost:9876/base/node_modules/systemjs/dist/system.src.js?e1a1843273d23ee5028aa25121066ce32fecdb29'}
19 04 2016 10:20:39.426:WARN [web-server]: 404: /base/node_modules/lodash/lodash.js
19 04 2016 10:20:39.641:WARN [web-server]: 404: /base/util.js
19 04 2016 10:20:39.643:WARN [web-server]: 404: /util.js
19 04 2016 10:20:39.646:WARN [web-server]: 404: /base/Subscription.js
19 04 2016 10:20:39.647:WARN [web-server]: 404: /base/Observer.js

IT doesn't seems to be a good idea to add 10 more lines to proxies... Any thoughts on that?

Thanks a lot.

PS: Unluckily https://github.com/xr0master/anyCuby is not longer available.

lathonez commented 8 years ago

Hey,

All good.

Yeah this is a massive pain. I do agree that once you've added a few lines to the proxies things start to feel pretty "wrong".

Fortunately I've been working on a solution to this (amongst other things) for a while.

See #68.

As of last night the code is ready, I'll be merging it back into main very soon, just tidying a few things up.

Why don't you check out the lightweightify branch and see how you get on with it?

There are a lot of changes. I'd advise:

Let me know how you get on? Please raise a new issue for any problems with that branch. I used to work in tier 3 support so am fairly anal about tickets / issues.

Thanks!

matiu commented 8 years ago

Thanks will try that an report back.

FYI, the example with the test working (adding a lot of lines in proxy: is at: https://github.com/matiu/ionic2-piano