Use const for requires

This commit is contained in:
Kevin Sawicki 2016-02-16 16:46:49 -08:00
parent 57f322a818
commit 709661156a
8 changed files with 41 additions and 66 deletions

View file

@ -1,14 +1,10 @@
var BrowserWindow, ChildProcess, app, assert, path, ref, remote; const assert = require('assert');
const ChildProcess = require('child_process');
const path = require('path');
const remote = require('electron').remote;
assert = require('assert'); const app = remote.require('electron').app;
const BrowserWindow = remote.require('electron').BrowserWindow;
ChildProcess = require('child_process');
path = require('path');
remote = require('electron').remote;
ref = remote.require('electron'), app = ref.app, BrowserWindow = ref.BrowserWindow;
describe('electron module', function() { describe('electron module', function() {
it ('can prevent exposing internal modules to require', function(done) { it ('can prevent exposing internal modules to require', function(done) {

View file

@ -1,10 +1,8 @@
var assert, clipboard, nativeImage, path, ref; const assert = require('assert');
const path = require('path');
assert = require('assert'); const clipboard = require('electron').clipboard;
const nativeImage = require('electron').nativeImage;
path = require('path');
ref = require('electron'), clipboard = ref.clipboard, nativeImage = ref.nativeImage;
describe('clipboard module', function() { describe('clipboard module', function() {
var fixtures; var fixtures;

View file

@ -1,18 +1,13 @@
var BrowserWindow, app, assert, crashReporter, http, multiparty, path, ref, remote, url; const assert = require('assert');
const http = require('http');
const multiparty = require('multiparty');
const path = require('path');
const url = require('url');
assert = require('assert'); const remote = require('electron').remote;
const app = remote.require('electron').app;
path = require('path'); const crashReporter = remote.require('electron').crashReporter;
const BrowserWindow = remote.require('electron').BrowserWindow;
http = require('http');
url = require('url');
multiparty = require('multiparty');
remote = require('electron').remote;
ref = remote.require('electron'), app = ref.app, crashReporter = ref.crashReporter, BrowserWindow = ref.BrowserWindow;
describe('crash-reporter module', function() { describe('crash-reporter module', function() {
var fixtures, isCI, w; var fixtures, isCI, w;
@ -63,7 +58,7 @@ describe('crash-reporter module', function() {
return server.listen(port, '127.0.0.1', function() { return server.listen(port, '127.0.0.1', function() {
port = server.address().port; port = server.address().port;
remote.process.port = port; remote.process.port = port;
url = url.format({ const crashUrl = url.format({
protocol: 'file', protocol: 'file',
pathname: path.join(fixtures, 'api', 'crash.html'), pathname: path.join(fixtures, 'api', 'crash.html'),
search: "?port=" + port search: "?port=" + port
@ -74,7 +69,7 @@ describe('crash-reporter module', function() {
submitURL: "http://127.0.0.1:" + port submitURL: "http://127.0.0.1:" + port
}); });
} }
return w.loadURL(url); return w.loadURL(crashUrl);
}); });
}); });
return describe(".start(options)", function() { return describe(".start(options)", function() {

View file

@ -1,12 +1,6 @@
var assert, path, remote, BrowserWindow; const assert = require('assert');
const path = require('path');
assert = require('assert'); const BrowserWindow = require('electron').remote.BrowserWindow;
path = require('path');
remote = require('electron').remote;
BrowserWindow = remote.BrowserWindow;
describe('debugger module', function() { describe('debugger module', function() {
var fixtures, w; var fixtures, w;

View file

@ -1,14 +1,13 @@
var BrowserWindow, assert, comparePaths, ipcMain, ipcRenderer, path, ref, ref1, remote; const assert = require('assert');
const path = require('path');
assert = require('assert'); const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote;
path = require('path'); const ipcMain = remote.require('electron').ipcMain;
const BrowserWindow = remote.require('electron').BrowserWindow;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, remote = ref.remote; const comparePaths = function(path1, path2) {
ref1 = remote.require('electron'), ipcMain = ref1.ipcMain, BrowserWindow = ref1.BrowserWindow;
comparePaths = function(path1, path2) {
if (process.platform === 'win32') { if (process.platform === 'win32') {
path1 = path1.toLowerCase(); path1 = path1.toLowerCase();
path2 = path2.toLowerCase(); path2 = path2.toLowerCase();

View file

@ -1,10 +1,10 @@
var Menu, MenuItem, assert, ipcRenderer, ref, ref1, remote; const assert = require('assert');
assert = require('assert'); const remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
ref = require('electron'), remote = ref.remote, ipcRenderer = ref.ipcRenderer; const Menu = remote.require('electron').Menu;
const MenuItem = remote.require('electron').MenuItem;
ref1 = remote.require('electron'), Menu = ref1.Menu, MenuItem = ref1.MenuItem;
describe('menu module', function() { describe('menu module', function() {
describe('Menu.buildFromTemplate', function() { describe('Menu.buildFromTemplate', function() {

View file

@ -1,8 +1,5 @@
var assert, screen; const assert = require('assert');
const screen = require('electron').screen;
assert = require('assert');
screen = require('electron').screen;
describe('screen module', function() { describe('screen module', function() {
describe('screen.getCursorScreenPoint()', function() { describe('screen.getCursorScreenPoint()', function() {

View file

@ -1,10 +1,6 @@
var assert, path, webFrame; const assert = require('assert');
const path = require('path');
assert = require('assert'); const webFrame = require('electron').webFrame;
path = require('path');
webFrame = require('electron').webFrame;
describe('webFrame module', function() { describe('webFrame module', function() {
var fixtures; var fixtures;