yargs, the command line parsing library, was unable to read the app's version automatically from package.json fix by passing the app's version as electron sees it
This commit is contained in:
@@ -170,16 +170,6 @@ describe('main/app/initialize', () => {
|
||||
await initialize();
|
||||
expect(app.setPath).toHaveBeenCalledWith('userData', '/basedir/some/dir');
|
||||
});
|
||||
|
||||
it('should show version and exit when specified', async () => {
|
||||
jest.spyOn(process.stdout, 'write').mockImplementation(() => {});
|
||||
const exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {});
|
||||
parseArgs.mockReturnValue({
|
||||
version: true,
|
||||
});
|
||||
await initialize();
|
||||
expect(exitSpy).toHaveBeenCalledWith(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('initializeConfig', () => {
|
||||
|
@@ -138,12 +138,6 @@ export async function initialize() {
|
||||
function initializeArgs() {
|
||||
global.args = parseArgs(process.argv.slice(1));
|
||||
|
||||
// output the application version via cli when requested (-v or --version)
|
||||
if (global.args.version) {
|
||||
process.stdout.write(`v.${app.getVersion()}\n`);
|
||||
process.exit(0); // eslint-disable-line no-process-exit
|
||||
}
|
||||
|
||||
global.isDev = isDev && !global.args.disableDevMode; // this doesn't seem to be right and isn't used as the single source of truth
|
||||
|
||||
if (global.args.dataDir) {
|
||||
|
Reference in New Issue
Block a user