<commit_before>var referee = require('referee');
var assert = referee.assert;
var refute = referee.refute;

var proxyquire = require('proxyquire');

// phantom smoke test

var mockedRunner = proxyquire('../../lib/report/index.js', {
    'gardr-validator': function (options, callback) {
        // test just want the options for verifying the actual option-object
        callback(null, options);
    }
});

describe('getReport', function () {

    it('calling runner without scriptUrl should return an error', function (done) {
        mockedRunner(null, function (err, result) {
            assert(err);
            done();
        });
    });

    it('calling runner should work, and return options as expected', function (done) {
        var id = 'id_' + Math.round(Math.random() * 100012391023);
        var input = {
            'output': {
                'url': id
            },
            'runnerConfig': {
                'viewport': {
                    height: 123
                }
            },
            id: id
        };

        mockedRunner(input, function (err, options) {
            refute(err, 'should not return error');
            assert.isObject(options);
            assert.isString(options.scriptUrl);
            assert.equals(options.scriptUrl, input.output.url);
            assert.equals(options.viewport.height, 123);
            done();
        });
    });

    var runner = require('../../lib/report/index.js');

    it('should work to run', function(done){
        this.timeout(3000);
        var options = {
            output: {
                url: 'about:blank'
            },
            'runnerConfig': {
                pageRunTime: 100
            },
            id: 'random'+Math.random(),

        };
        runner(options, function(err, result){
            refute(err);
            assert(result.log);
            assert(result.har);
            done();
        });
    });
});<commit_msg>fix output of screenshot on test run<commit_after>var referee = require('referee');
var assert = referee.assert;
var refute = referee.refute;
var os = require('os');

var proxyquire = require('proxyquire');

var mockedRunner = proxyquire('../../lib/report/index.js', {
    'gardr-validator': function (options, callback) {
        // test just want the options for verifying the actual option-object
        callback(null, options);
    }
});

describe('getReport', function () {

    it('calling runner without scriptUrl should return an error', function (done) {
        mockedRunner(null, function (err, result) {
            assert(err);
            done();
        });
    });

    it('calling runner should work, and return options as expected', function (done) {
        var id = 'id_' + Math.round(Math.random() * 100012391023);
        var input = {
            'output': {
                'url': id
            },
            'runnerConfig': {
                'viewport': {
                    height: 123
                }
            },

            id: id
        };

        mockedRunner(input, function (err, options) {
            refute(err, 'should not return error');
            assert.isObject(options);
            assert.isString(options.scriptUrl);
            assert.equals(options.scriptUrl, input.output.url);
            assert.equals(options.viewport.height, 123);
            done();
        });
    });

    var runner = require('../../lib/report/index.js');

    it('should work to run', function(done){
        this.timeout(3000);
        var options = {
            output: {
                url: 'about:blank'
            },
            'runnerConfig': {
                pageRunTime: 100,
                outputDirectory: os.tmpDir()
            },
            id: 'random'+Math.random(),
        };
        runner(options, function(err, result){
            refute(err);
            assert(result.log);
            assert(result.har);
            done();
        });
    });
});
{'fraction_non_alphanumeric': 0.13466397170288025, 'fraction_numerical': 0.012632642748863061, 'mean_word_length': 1.6768086544962812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3678183', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1031, 'n_words': 250}