Comments (13)
The problem that jasmineDone
never runs in the console_reporter
, but I have no idea how to fix it. It runs every test, but after that it exits without reporting the failures. The suiteDone
and specDone
seems to run properly.
I guess the problem is in the core, so I have to dig deeper in the code. :S
from jasmine-npm.
Here is what I got in webstorm:
and here is what I got in bash:
from jasmine-npm.
I created an issue by webstorm as well: https://youtrack.jetbrains.com/issue/WEB-15046
from jasmine-npm.
I think I was wrong. I added console.log("x")
to the first line, and it sometimes prints the x
, sometimes not. If I add multiple console.log
, only the first one prints, the seconds one not. There is no character limit, I removed a test file from about 5, and after that I did not get the x
. After I restored the file, I got the x
again, so it is rapsodic whether it prints. When I removed that test file, it did not end every test, or at least it did not write all F-s and .-s. So this is more serious than I previously thought.
from jasmine-npm.
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.
from jasmine-npm.
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.
from jasmine-npm.
Based on your investigation, this sounds like an issue with WebStorm terminating the jasmine
command early and not jasmine-npm itself. Closing.
Thanks for using jasmine!
from jasmine-npm.
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.
from jasmine-npm.
https://youtrack.jetbrains.com/issue/WEB-1926
It seems to be a 3 years old windows + nodejs issue which will be fixed in Node.js v0.11.12 I have the 0.10.36 now. That's all.
from jasmine-npm.
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!
from jasmine-npm.
Another workaround is to use https://github.com/cowboy/node-exit instead of process.exit
as some other node console tools (e.g. grunt) do.
from jasmine-npm.
Nice, it appears to be complicated to exit properly in node :D
https://github.com/cowboy/node-exit/blob/master/lib/exit.js
Thanks segrey!
from jasmine-npm.
@segrey Thanks for the workaround, I pulled in the exit module.
from jasmine-npm.
Related Issues (20)
- jasmine flags, oneFailurePerSpec and stopSpecOnExpectationFailure don't work well HOT 2
- RFC: Well-defined public API HOT 1
- Can't get Jasmine 4 to support .jsx files HOT 7
- Failed to load reporter module jasmine 4.x HOT 1
- Jasmine loads test dependency as CommonJS module instead of ESM HOT 2
- Export Loader HOT 2
- getting an error jasmine.getEnv is not a function HOT 2
- Unable to find specs when using [email protected] HOT 2
- Consider using child_process.fork() to parallelize Jasmine runs HOT 28
- Jasmine 4 ES Modules / Dynamic Import Doesn't Work with Paths that Have Encoded Slashes HOT 4
- jasmine --helper flag broken following addHelperFiles() removal
- --reporter does not work with namespaced modules HOT 4
- Feature Request: Allow re-running test suites without restarting HOT 2
- Package subpath './lib/command.js' is not defined by "exports" using jasmine-xml-reporter HOT 1
- Vulnerabilities found on latest version of Jasmine(4.6.0) HOT 1
- Problem excluding files HOT 4
- Project base dirs containing special Glob syntax don't work HOT 1
- Regression in jasmine 5: settings bleed over to next `Jasmine` instance HOT 4
- `--require` fails with `runner.addRequires is not a function` in 5.x HOT 1
- Add a `--verbose` flag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasmine-npm.