-
Notifications
You must be signed in to change notification settings - Fork 145
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
Reporter not compatible with WebStorm #20
Comments
The problem that I guess the problem is in the core, so I have to dig deeper in the code. :S |
I created an issue by webstorm as well: https://youtrack.jetbrains.com/issue/WEB-15046 |
I think I was wrong. I added |
I think WebStorm forces the nodejs to close, or something like this happens. With a single test only it does not print anything. So it depends on the test count. |
WebStorm and PhpStorm has the same issue with reporters. It runs the code, but stops reporting after a while. I guess it depends on how many times you call the console.log or the stdout.write. I modified https://github.com/jasmine/jasmine-npm/blob/master/lib/command.js#L65 to write only a single time. Now it works in most of the cases, but sometimes prints nothing. (I guess this should be fixed by WebStorm, not here.) function runJasmine(jasmine, env) {
jasmine.loadConfigFile(process.env.JASMINE_CONFIG_PATH);
var report = "";
jasmine.configureDefaultReporter({
showColors: env.color,
print: function() {
report += util.format.apply(this, arguments);
},
onComplete: function(passed) {
process.stdout.write(report);
if(passed) {
process.exit(0);
}
else {
process.exit(1);
}
}
});
jasmine.execute(env.files);
} I think it is sad, that currently we cannot configure the default reporter in the config file. This whole code should be placed there as something exceptional. |
Based on your investigation, this sounds like an issue with WebStorm terminating the Thanks for using jasmine! |
You are right, I think it is a WebStorm issue. It does not terminate the command, but its console stops receiving the printed data. I had the same issue with PHPStorm and SimpleTest (an old PHP testing framework). I'll check the code of jasmine-node, maybe there is a known solution in there, because jasmine-node worked properly with these IDEs. I'll send a pull request if I find something. I'll add a feature request about the custom reporter. |
https://youtrack.jetbrains.com/issue/WEB-1926 |
I have found the perfect workaround. Just replace this line: https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js#L43 options.onComplete = options.onComplete || defaultOnComplete; with this: options.onComplete = (function (onComplete) {
return function (){
var context = this;
var args = arguments;
setTimeout(function (){
onComplete.apply(context, args);
},1);
};
})(options.onComplete || defaultOnComplete); If you have the same issue on windows. It simply defers the exit with 1ms. That seems to be enough time to end the printing. Good day, ciao! |
Another workaround is to use https://github.com/cowboy/node-exit instead of |
Nice, it appears to be complicated to exit properly in node :D Thanks segrey! |
- process.exit isn't properly waiting for buffers to finish writing in Windows - issue in node fixed in v0.11.12: nodejs/node-v0.x-archive#3584 Fixes #20
@segrey Thanks for the workaround, I pulled in the exit module. |
The reporter is not compatible with WebStorm, I got only
...FFF.....F..
etc... in the console, but no failure details. I checked, in nodejs it runs properly.The text was updated successfully, but these errors were encountered: