Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: 'Potentially unhandled rejection on Windows10 #135

Open
dotnetCarpenter opened this issue Mar 9, 2016 · 2 comments
Open

ERROR: 'Potentially unhandled rejection on Windows10 #135

dotnetCarpenter opened this issue Mar 9, 2016 · 2 comments

Comments

@dotnetCarpenter
Copy link
Contributor

I have deep dived into karma-jspm and tried to find a solution but are giving up. I get the following error when I run my tests via karma start :

09 03 2016 13:25:32.302:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#ELe2rL4fadNwgDfCAAAA with id 52977691
09 03 2016 13:25:32.477:WARN [web-server]: 404: /js/app.js
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR: 'Potentially unhandled rejection [4] http://localhost:9876/base/jspm_packages/system.src.js?281591da6090abed69cd0b080aa69c8de089a41c:733:14
tryCatchReject@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1252:34
runContinuation1@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1211:18
when@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1032:20
run@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:890:17
_drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:166:22
drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:131:15'

09 03 2016 13:25:42.496:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

I'm not able to load any file (and I have tried many different paths). But if I put the same files in the karma config files array, they load. But since I use es2015 modules, that doesn't work without jspm.

I have the following structure:

karma.conf.js
config.js
js/
  |_app.js
  |_danishify.js
test/
  |_danishify.spec.js
images/
jspm_packages/
node_modules/

My karma.conf.js:

module.exports = function(config) {
    config.set({
        basePath: '',

        frameworks: ['jspm', 'jasmine'],
// list of files / patterns to load in the browser
        files: [
        ],

        jspm: {
            config: 'config.js',
            loadFiles: ['js/*.js','test/danishify.spec.js'],
            serveFiles: ['**/*.+(js|html|css|json|png|gif)']
        },

        // list of files to exclude
        exclude: [
        ],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
        },

        browsers: ['PhantomJS'],
       //         ...

I use es2015 modules in the test.

// danishify.spec.js
'use strict'
import danishify from '../js/danishify.js'

// danishify.js
export default (function(){
  // ...
}());
@dotnetCarpenter
Copy link
Contributor Author

Hmm.. Perhaps it is the issue described in this article: http://martinmicunda.com/2015/10/19/how-to-start-writing-unit-tests-with-es6-angular-1x-and-jspm/

Depends on your application file structure you might see 404 error when you run your test. To fix this error you need to proxy your paths to /base/ prefix e.g.:

proxies: {
    '/test/': '/base/test/',
    '/src/app/': '/base/src/app/',
    '/jspm_packages/': '/base/jspm_packages/'
}

NOTE: This is bug in karma-jspm and it might be fix in the future so you will not need to proxy anything.

@dotnetCarpenter
Copy link
Contributor Author

While using proxies, fixes the 404's my issue persist. Does anyone know what goes wrong?

npm test

> [email protected] test C:\Users\dotnet\Projects\playground\danishify
> karma start

09 03 2016 14:01:28.091:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
09 03 2016 14:01:28.106:INFO [launcher]: Starting browser PhantomJS
09 03 2016 14:01:29.791:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#Dl5cayeEZwXpIKclAAAA with id 89243764
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR: 'Potentially unhandled rejection [3] http://localhost:9876/base/jspm_packages/system.src.js?281591da6090abed69cd0b080aa69c8de089a41c:733:14
tryCatchReject@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1252:34
runContinuation1@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1211:18
when@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1032:20
run@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:890:17
_drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:166:22
drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:131:15'

09 03 2016 14:01:40.440:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

npm ERR! Test failed.  See above for more details.

@dotnetCarpenter dotnetCarpenter changed the title 404 when loading files on Windows ERROR: 'Potentially unhandled rejection on Windows10 Mar 9, 2016
dotnetCarpenter added a commit to dotnetCarpenter/danishify that referenced this issue Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant