Various build and developer fixes, some optimizations (#2975)
* Various build and developer fixes, some optimizations * Fix the linux build * Fix afterpack * Fix notarization variables * Revert macos-notification-state changes from this PR * Only build the tar for PRs * Also ci * Fix copy script * Fix copy script more * Remove @babel/cli * Fix windows build * Fix MAS build
This commit is contained in:
@@ -309,5 +309,5 @@ function validateAgainstSchema<T>(data: T, schema: Joi.ObjectSchema<T> | Joi.Arr
|
||||
log.error(`Validation failed due to: ${error}`);
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
return value as T;
|
||||
}
|
||||
|
@@ -41,10 +41,16 @@ jest.mock('main/i18nManager', () => ({
|
||||
|
||||
describe('main/CriticalErrorHandler', () => {
|
||||
const criticalErrorHandler = new CriticalErrorHandler();
|
||||
const env = process.env;
|
||||
|
||||
describe('processUncaughtExceptionHandler', () => {
|
||||
beforeEach(() => {
|
||||
app.isReady.mockImplementation(() => true);
|
||||
process.env = {...env, NODE_ENV: 'jest'};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
process.env = env;
|
||||
});
|
||||
|
||||
it('should throw error if app is not ready', () => {
|
||||
|
@@ -33,7 +33,7 @@ function triageArgs(args: string[]) {
|
||||
// TODO: Translations?
|
||||
|
||||
function parseArgs(args: string[]) {
|
||||
return yargs.
|
||||
return yargs().
|
||||
alias('dataDir', 'd').
|
||||
string('dataDir').
|
||||
describe('dataDir', 'Set the path to where user data is stored.').
|
||||
|
@@ -1,19 +1,20 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
import {dialog, screen} from 'electron';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
import JsonFileManager from 'common/JsonFileManager';
|
||||
import {updatePaths} from 'main/constants';
|
||||
|
||||
import {getDeeplinkingURL, resizeScreen, migrateMacAppStore} from './utils';
|
||||
|
||||
jest.mock('fs-extra', () => ({
|
||||
jest.mock('fs', () => ({
|
||||
readFileSync: jest.fn(),
|
||||
writeFileSync: jest.fn(),
|
||||
existsSync: jest.fn(),
|
||||
copySync: jest.fn(),
|
||||
cpSync: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('electron', () => ({
|
||||
@@ -188,7 +189,7 @@ describe('main/app/utils', () => {
|
||||
dialog.showMessageBoxSync.mockReturnValue(0);
|
||||
dialog.showOpenDialogSync.mockReturnValue(['/old/data/path']);
|
||||
migrateMacAppStore();
|
||||
expect(fs.copySync).toHaveBeenCalledWith('/old/data/path', '/path/to/data');
|
||||
expect(fs.cpSync).toHaveBeenCalledWith('/old/data/path', '/path/to/data');
|
||||
expect(updatePaths).toHaveBeenCalled();
|
||||
expect(migrationPrefs.setValue).toHaveBeenCalledWith('masConfigs', true);
|
||||
});
|
||||
|
@@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import type {BrowserWindow, Rectangle, Session} from 'electron';
|
||||
import {app, Menu, session, dialog, nativeImage, screen} from 'electron';
|
||||
import isDev from 'electron-is-dev';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
import {APP_MENU_WILL_CLOSE} from 'common/communication';
|
||||
import Config from 'common/config';
|
||||
@@ -235,7 +235,7 @@ export function migrateMacAppStore() {
|
||||
}
|
||||
|
||||
try {
|
||||
fs.copySync(result[0], app.getPath('userData'));
|
||||
fs.cpSync(result[0], app.getPath('userData'));
|
||||
updatePaths(true);
|
||||
migrationPrefs.setValue('masConfigs', true);
|
||||
} catch (e) {
|
||||
|
@@ -12,13 +12,6 @@ import CallsWidgetWindow from 'main/windows/callsWidgetWindow';
|
||||
|
||||
import {createTemplate} from './app';
|
||||
|
||||
jest.mock('fs-extra', () => ({
|
||||
readFileSync: jest.fn(),
|
||||
writeFileSync: jest.fn(),
|
||||
existsSync: jest.fn(),
|
||||
copySync: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('electron-extension-installer', () => {
|
||||
return () => ({
|
||||
REACT_DEVELOPER_TOOLS: 'react-developer-tools',
|
||||
|
Reference in New Issue
Block a user