Clean logs on start - and eslint/mocha with code coverage (#1945)

* Clean logs on startup; install server-side testing/linting

* Add eslint config, make all of app/ conform to its demands

* Add Node.js testing and linting to CI

* Lock project to Node.js 7.9.0, used by Electron 1.7.10

* New eslint error: trailing commas in function argumensts

Node 7.9.0 doesn't like trailing commas, but Electron does

* Move electron to devDependency, tell eslint it's built-in
This commit is contained in:
Scott Nonnenberg 2018-01-08 13:19:25 -08:00 committed by GitHub
parent 6464d0a5fa
commit 64fe9dbfb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 1782 additions and 316 deletions

View file

@ -1,9 +1,9 @@
const path = require('path');
const fs = require('fs');
const app = require('electron').app;
const { app } = require('electron');
const _ = require('lodash');
const logger = require('./logging').getLogger();
const logging = require('./logging');
function normalizeLocaleName(locale) {
if (/^en-/.test(locale)) {
@ -28,7 +28,8 @@ function getLocaleMessages(locale) {
}
function load() {
let english = getLocaleMessages('en');
const logger = logging.getLogger();
const english = getLocaleMessages('en');
let appLocale = app.getLocale();
if (process.env.NODE_ENV === 'test') {
@ -49,7 +50,7 @@ function load() {
// We start with english, then overwrite that with anything present in locale
messages = _.merge(english, messages);
} catch (e) {
logger.error('Problem loading messages for locale ' + localeName + ' ' + e.stack);
logger.error(`Problem loading messages for locale ${localeName} ${e.stack}`);
logger.error('Falling back to en locale');
localeName = 'en';
@ -58,10 +59,10 @@ function load() {
return {
name: localeName,
messages
messages,
};
}
module.exports = {
load: load
load,
};