jasmine/gulp-jasmine-browser

Is there any way to print console error from the headless Chrome?

brookhong opened this issue · 2 comments

For example, I created a gulp task to test my chrome extension, to load content_scripts as below:

gulp.task('test', function () {
    return gulp.src(['content_scripts/**/*.js', 'tests/*.spec.js'])
        .pipe(jasmineBrowser.specRunner({console: true}))
        .pipe(jasmineBrowser.headless({driver: 'chrome'}));
});

I know there must be some console errors from the headless browser to load content_scripts without loading some other lib, but how to get the console error inside headless chrome printed out on my shell of running gulp?

rdy commented

it should print console.log right now, it could probably be extended to console.error and console.warn as well.

@rdy it's not printing anything if you use puppeteer latest . It works using old puppeteer version 0.13.0 (the same as in this project dependency). Also It doesn't work 100% correctly, it will print strings only and with the prefix JSHandle:.

I think that, since the api for page.on('console' is different between versions in latest fails.

Will try to PR making sure it works in latest version and in 0.13.0. since . Another solution would be document users to use that specific version and/or update this project puppeteer dependency. Also add a test that verify messages are actually printed to stdout.