{"size": 1009, "ext": "js", "max_stars_repo_path": "renderer/test-starter.js", "max_stars_repo_name": "skellock/electron-ava", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "renderer/test-starter.js", "max_issues_repo_name": "skellock/electron-ava", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "renderer/test-starter.js", "max_forks_repo_name": "skellock/electron-ava", "max_forks_repo_forks_event_min_datetime": "2018-08-04T00:28:47.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-04T00:28:47.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 29.6764705882, "max_line_length": 83, "alphanum_fraction": 0.7492566898}
'use strict';
const {ipcRenderer} = require('electron');
const serializeError = require('ava/lib/serialize-error');

// Setup as soon as possible
function onUncaughtException(err) {
	ipcRenderer.send('ava-message', 'uncaughtException', {
		exception: serializeError(err)
	});
}

process.on('uncaughtException', onUncaughtException);

function parseArgv() {
	const unencodedHash = decodeURIComponent(window.location.hash.substr(1));
	const argv = JSON.parse(unencodedHash);

	return argv;
}

process.argv = parseArgv();

require('./process-adapter'); // eslint-disable-line import/no-unassigned-import
require('./globals'); // eslint-disable-line import/no-unassigned-import
require('./console'); // eslint-disable-line import/no-unassigned-import

// Ensure the tests only run once
ipcRenderer.once('test-start', () => {
	require('ava/lib/test-worker'); // eslint-disable-line import/no-unassigned-import

	// Disable duplicate reporting
	process.removeListener('uncaughtException', onUncaughtException);
});
