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

Socket hang up error when trying to run in background via grunt watch #147

Open
gunnx opened this issue Apr 16, 2015 · 4 comments
Open

Socket hang up error when trying to run in background via grunt watch #147

gunnx opened this issue Apr 16, 2015 · 4 comments

Comments

@gunnx
Copy link

gunnx commented Apr 16, 2015

I'm trying to setup continuous testing using grunt-watch but keep getting an error 'Socket hung up'

my grunt config for karma:

karma: {
 options: {
      basePath: '',
      autoWatch: false,
      colors: true,
      frameworks: ['mocha', 'chai'],
      logLevel: 'DEBUG',
      port: 9876,
      browsers: ['PhantomJS'],
      singleRun: true
    },
    dev: {
      options: {
        port: 9877,
        background: true,
        singleRun: false
      },
      browsers: ['Chrome'],
      files: {
        src: [
          'src/js/vendor/jquery-1.11.2.min.js',
          'test/vendor/chai-jquery.js',
          'test/mocha/fixtures/**/*.fixture.html',
          'src/js/**/*.js',
          'test/mocha/lib/*.js',
          'test/mocha/**/*.js'
        ]
      },
      preprocessors: {
        'test/mocha/fixtures/**/*.fixture.html': ['html2js']
      },
      reporters: ['nyan']
  }
}

my grunt watch task

karma: {
    files: ['src/js/module/**/*.js', 'test/mocha/**/*.spec.js'],
    tasks: ['karma:dev:run']
  },

I test by running grunt karma:dev:start watch:karma I can see the process running and blocking.
If I then edit a file it runs the karma:dev:run task but this throws an error:

output:

$ grunt karma:dev:start watch:karma
Running "karma:dev:start" (karma) task

Running "watch:karma" (watch) task
Waiting...
>> File "test/mocha/calculator.spec.js" changed.
Running "karma:dev:run" (karma) task
[2015-04-16 16:39:39.040] [DEBUG] config - No config file specified.
>> Error
Fatal error: socket hang up

using grunt-karma 0.10.1 and karma 0.12.31 and grunt-watch 0.6.1

@Krinkle
Copy link
Collaborator

Krinkle commented Aug 1, 2015

I'm experiencing the same thing.

31 07 2015 16:58:00.937:WARN [proxy]: failed to proxy /w/load.php?modules=jquery%2Cmediawiki&only=scriptsversion=woIh%2FgTQ
 (socket hang up)
31 07 2015 16:58:00.937:WARN [proxy]: failed to proxy /w/load.php?modules=jquery%2Cmediawiki&only=scriptsversion=woIh%2FgTQ
 (socket hang up)
31 07 2015 16:58:00.937:WARN [proxy]: failed to proxy /w/load.php?modules=jquery%2Cmediawiki&only=scriptsversion=woIh%2FgTQ
 (socket hang up)
        karma: {
            options: {
                proxies: { "/w": "http://mediawiki.dev/w" }

@mianowski
Copy link

Hi @Krinkle,
I know this is an old thread, but just for your and other proxies users' information:
If you don't provide proxy target URL with a port number, it gets default karma port (in default case: 9876). This results in
DEBUG [proxy]: �[39mproxying request - <proxied_file> to <target_url>:9876
Correcting this to 80 (http) or 443 (https) solved the problem for me.

@ilkercat
Copy link

Hi @Krinkle,
I also know that this is an old thread ;)
I had the same issue and figured out that I have ciruclar proxies -> My proxies were using them selves.

In my case /base/app has been extracted to a proxy, eg. "/app". The target URLs were using "/app/.../..." which caused that /app was called in an endless loop -> socket hang up

@Krinkle
Copy link
Collaborator

Krinkle commented Apr 12, 2016

@ilkercat @mianowski This bug is now fixed. See karma-runner/karma#1987.

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

4 participants