-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Notification on webserver port binding #1467
Comments
Which part of the api exactly are you referring to? The plugin api or the node api? |
@dignifiedquire No particular preference for API.
Didn't test, but looks like there is another way:
The only problem here is that it depends on |
This adds a slew of new api possibilities to the server. All main events from the `globalEmitter` are now emitted on the `server` instances and publicly available. For a list of available events see the docs file. BREAKING CHANGE: The public api interface has changed to a constructor form. To upgrade change ```javascript var server = require(‘karma’).server server.start(config, done) ``` to ```javascript var Server = require(‘karma’).Server var server = new Server(config, done) server.start() ``` Closes karma-runner#1037, karma-runner#1482, karma-runner#1467
@dignifiedquire Sorry for the late reply. Thanks for looking into this. Really appreciate it. About webserver port binding event: I'm thinking of using
What do you think about legitimating this way? |
Sure sounds good, let's use 'webserver_listening' event on the server to propagate the event. are you up for a quick PR on it? |
I don't think a special event like The only thing I'd like to have is legitimating this way to protect from breaking changes. If a breaking change is needed, then this way will be supported along with a new way for at least one version. |
It's not needed, but I want all events to be on the |
Makes sense. Will create a PR. |
@segrey In latest version of karma we emit event 'listening' when webServer started, seems it should fix this issue and we can refactor this code. I think we can close this issue as fixed, @segrey what are you think? :) |
Related issue #1874 |
Thanks, great! That's just what's needed. For backward compatibility with previous karma versions |
@segrey No problem :) |
Based on #614
WebStorm Karma integration listens to webserver port binding event (i.e. when this line printed https://github.com/karma-runner/karma/blob/v1.0.0-0/lib/server.js#L61).
Now the only way to accomplish this is to parse standard output of Karma server and mine data from lines like:
Such an approach seems to be not very safe, e.g. it'll fail if
logLevel: config.LOG_DISABLE
is set. Well, actually, there is a workaround for this case:LOG_DISABLE
is not allowed https://github.com/karma-runner/karma-intellij/blob/master/lib/intellij.conf.js#L50. But still it doesn't feel right.It'd be nice if plugins could use some API to listen to webserver port binding event. Thanks!
The text was updated successfully, but these errors were encountered: