<commit_before>'use strict';

const assert = require('assert');
const url = require('url');

const Chrome = require('../');

describe('connecting to Chrome', () => {
    describe('with callback', () => {
        describe('with default parameters', () => {
            it('should succeed with "connect" callback passed as an argument', (done) => {
                Chrome((chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
        });
        describe('with custom parameters', () => {
            it('should succeed with "connect" callback passed as an argument', (done) => {
                Chrome({'host': 'localhost', 'port': 9222}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by index', (done) => {
                Chrome({'target': function () { return 0; }}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by object', (done) => {
                Chrome({'target': function (targets) { return targets[0]; }}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by full URL', (done) => {
                Chrome.Version((err, info) => {
                    assert.ifError(err);
                    const browserUrl = info.webSocketDebuggerUrl || 'ws://localhost:9222/devtools/browser';
                    Chrome({'target': browserUrl}, (chrome) => {
                        chrome.close(done);
                    }).on('error', () => {
                        assert(false);
                    });
                });
            });
            it('should succeed with custom target by partial URL', (done) => {
                Chrome.Version((err, info) => {
                    assert.ifError(err);
                    if (info.webSocketDebuggerUrl) {
                        info.webSocketDebuggerUrl = url.parse(info.webSocketDebuggerUrl).pathname;
                    }
                    const browserUrl = info.webSocketDebuggerUrl || '/devtools/browser';
                    Chrome({'target': browserUrl}, (chrome) => {
                        chrome.close(done);
                    }).on('error', () => {
                        assert(false);
                    });
                });
            });
            it('should succeed with custom target by id', (done) => {<commit_msg>Add missing connection test case<commit_after>'use strict';

const assert = require('assert');
const url = require('url');

const Chrome = require('../');

describe('connecting to Chrome', () => {
    describe('with callback', () => {
        describe('with default parameters', () => {
            it('should succeed with "connect" callback passed as an argument', (done) => {
                Chrome((chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
        });
        describe('with custom parameters', () => {
            it('should succeed with "connect" callback passed as an argument', (done) => {
                Chrome({'host': 'localhost', 'port': 9222}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by index', (done) => {
                Chrome({'target': function () { return 0; }}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by function', (done) => {
                Chrome({'target': function (targets) { return targets[0]; }}, (chrome) => {
                    chrome.close(done);
                }).on('error', () => {
                    assert(false);
                });
            });
            it('should succeed with custom target by object', (done) => {
                Chrome.Version((err, info) => {
                    assert.ifError(err);
                    Chrome({'target': info}, (chrome) => {
                        chrome.close(done);
                    }).on('error', () => {
                        assert(false);
                    });
                });
            });
            it('should succeed with custom target by full URL', (done) => {
                Chrome.Version((err, info) => {
                    assert.ifError(err);
                    const browserUrl = info.webSocketDebuggerUrl || 'ws://localhost:9222/devtools/browser';
                    Chrome({'target': browserUrl}, (chrome) => {
                        chrome.close(done);
                    }).on('error', () => {
                        assert(false);
                    });
                });
            });
            it('should succeed with custom target by partial URL', (done) => {
                Chrome.Version((err, info) => {
                    assert.ifError(err);
                    if (info.webSocketDebuggerUrl) {
                        info.webSocketDebuggerUrl = url.parse(info.webSocketDebuggerUrl).pathname;
                    }
                    const browserUrl = info.webSocketDebuggerUrl || '/devtools/browser';
                    Chrome({'target': browserUrl}, (chrome) => {
                        chrome.close(done);
                    }).on('error', () => {
                        assert(false);
                    });
                });
            });
            it('should succeed with custom target by id', (done) => {
{'fraction_non_alphanumeric': 0.15271586594023445, 'fraction_numerical': 0.003301964668978042, 'mean_word_length': 1.2638266068759343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 57, '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': '2526339', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1371, 'n_words': 307}