Reputation: 3041
My tests have a lot of bloated output. Instead of simply printing the test results as I have seen before:
Finished in 0.052 seconds
2 tests, 5 assertions, 0 failures, 0 skipped
I am now seeing the content of the objects that are being used during the test. I think that this is isolated to my module, but I am not positive given that this is my first time using node.
Recreate the issue
$ git clone https://github.com/spencerdcarlson/javaparser.git
$ cd javaparser/
$ npm install --only=dev
$ npm test
Thanks in advance for your help
Upvotes: 0
Views: 78
Reputation: 15289
It seems your code prints directly to stdout, so it really can't be helped easliy from karma/jasmine/node side of things.
You could pipe the output via a filter program which then prints back just what you want to see, but that's a lot of work.
Why don't you modify your code to let you specify a stream (or null) for your stdout in the options (I see you already have options parameter in your parse() function.
JavaParser.parse = function parse(file, options, cb) {
...
const rl = readline.createInterface({
input: stream,
output: (options.stdout === undefined)? process.stdout : options.stdout;
});
...
}
Then you can pass a dummy stdout when running tests.
Disclaimer: I have not studied your code to check if this is where it is printing to stdout, this is just to give you an idea. I'm also not sure if passing null will work for node apps. On Linux you can pipe to /dev/null.
Upvotes: 1