Skip to content

Commit

Permalink
Merge pull request #180 from forcedotcom/deps
Browse files Browse the repository at this point in the history
upgrade dependencies + fix tests
  • Loading branch information
maliroteh-sf authored Aug 1, 2024
2 parents 19c7d9e + 7378faf commit 05f57c3
Show file tree
Hide file tree
Showing 10 changed files with 2,754 additions and 3,761 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
3 changes: 2 additions & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
network-timeout 600000
network-timeout 600000
registry=https://registry.yarnpkg.com
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,35 @@
"@oclif/core": "^3.8.0",
"@oclif/plugin-version": "^2.2.9",
"@salesforce/core": "^5.3.12",
"@salesforce/lwc-dev-mobile-core": "^3.3.1",
"@salesforce/sf-plugins-core": "^4.0.0",
"@salesforce/lwc-dev-mobile-core": "^3.3.0",
"chalk": "^4.1.2"
},
"devDependencies": {
"@types/inquirer": "^9.0.6",
"@types/cli-progress": "^3.11.6",
"@types/inquirer": "^9.0.7",
"@types/jest": "^29.5.12",
"@types/node": "^22.0.2",
"@types/sinon": "^10.0.20",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.9.0",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-jsdoc": "^48.10.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-unicorn": "^49.0.0",
"husky": "^8.0.3",
"eslint-plugin-unicorn": "^55.0.0",
"husky": "^9.1.4",
"jest": "^29.7.0",
"jest-chain": "^1.1.6",
"jest-extended": "^4.0.2",
"jest-junit": "^16.0.0",
"lint-staged": "^15.0.2",
"oclif": "^4.0.3",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"lint-staged": "^15.2.7",
"oclif": "^4.14.12",
"prettier": "^3.3.3",
"ts-jest": "^29.2.4",
"typescript": "^5.5.4"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import { Config } from '@oclif/core/lib/config';
import { Options } from '@oclif/core/lib/interfaces';
import { Logger } from '@salesforce/core';
import {
AndroidPackage,
AndroidUtils,
CommonUtils,
IOSUtils,
LoggerSetup,
RequirementProcessor,
Version
} from '@salesforce/lwc-dev-mobile-core';
Expand Down Expand Up @@ -134,9 +134,10 @@ describe('Create Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-logger');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);
jest.spyOn(
AndroidUtils,
'fetchSupportedEmulatorImagePackage'
Expand All @@ -146,8 +147,10 @@ describe('Create Tests', () => {
);
const create = makeCreate(deviceName, androidDeviceType, 'android');
await create.init();
const loggerSpy = jest.spyOn(create.logger, 'info');
await create.run();
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

test('Messages folder should be loaded', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import { Config } from '@oclif/core/lib/config';
import { Options } from '@oclif/core/lib/interfaces';
import { Logger } from '@salesforce/core';
import {
AndroidVirtualDevice,
AndroidUtils,
IOSSimulatorDevice,
IOSUtils,
LoggerSetup,
Version
} from '@salesforce/lwc-dev-mobile-core';
import { List } from '../list';
Expand Down Expand Up @@ -116,16 +116,19 @@ describe('List Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-logger');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);
jest.spyOn(AndroidUtils, 'fetchEmulators').mockImplementation(
fetchEmulatorsMock
);
const list = makeList('android');
await list.init();
const loggerSpy = jest.spyOn(list.logger, 'info');
await list.run();
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

test('Messages folder should be loaded', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import { Config } from '@oclif/core/lib/config';
import { Options } from '@oclif/core/lib/interfaces';
import { Logger } from '@salesforce/core';
import {
AndroidUtils,
CommonUtils,
IOSSimulatorDevice,
IOSUtils,
LoggerSetup,
RequirementProcessor
} from '@salesforce/lwc-dev-mobile-core';
import { Start } from '../start';
Expand Down Expand Up @@ -116,9 +116,10 @@ describe('Start Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-logger');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);

const bootDeviceMock = jest.fn(() => Promise.resolve());
const launchSimulatorAppMock = jest.fn(() => Promise.resolve());
Expand All @@ -135,8 +136,10 @@ describe('Start Tests', () => {

const start = makeStart('iOS', targetName);
await start.init();
const loggerSpy = jest.spyOn(start.logger, 'info');
await start.run();
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

test('Messages folder should be loaded', async () => {
Expand Down
10 changes: 7 additions & 3 deletions src/cli/commands/force/lightning/lwc/__tests__/preview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AndroidLauncher,
CommonUtils,
IOSLauncher,
LoggerSetup,
PreviewUtils,
RequirementProcessor
} from '@salesforce/lwc-dev-mobile-core';
Expand Down Expand Up @@ -271,13 +272,16 @@ describe('Preview Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-preview');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);
const preview = makePreview('compname', 'android', 'sfdxdebug');
await preview.init();
const loggerSpy = jest.spyOn(preview.logger, 'info');
await preview.run();
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

test('Messages folder should be loaded', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

import { Config } from '@oclif/core/lib/config';
import { Options } from '@oclif/core/lib/interfaces';
import { Logger, Messages, SfError } from '@salesforce/core';
import { Messages, SfError } from '@salesforce/core';
import {
AndroidVirtualDevice,
AndroidUtils,
CommonUtils,
IOSSimulatorDevice,
IOSUtils,
LoggerSetup,
RequirementProcessor,
Version
} from '@salesforce/lwc-dev-mobile-core';
Expand Down Expand Up @@ -310,18 +311,21 @@ describe('Mobile UI Test Configuration Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-logger');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);

const cmd = createCommand({
platform: 'ios',
deviceName: 'iPhone 8'
});

await cmd.init();
const loggerSpy = jest.spyOn(cmd.logger, 'info');
await cmd.run();
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

test('Messages folder should be loaded', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { Config } from '@oclif/core/lib/config';
import { Options } from '@oclif/core/lib/interfaces';
import { Logger, Messages } from '@salesforce/core';
import { CommonUtils } from '@salesforce/lwc-dev-mobile-core';
import { Messages } from '@salesforce/core';
import { CommonUtils, LoggerSetup } from '@salesforce/lwc-dev-mobile-core';
import { Run } from '../run';
import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -236,9 +236,10 @@ describe('Mobile UI Test Run Tests', () => {
});

test('Logger must be initialized and invoked', async () => {
const logger = new Logger('test-logger');
const loggerSpy = jest.spyOn(logger, 'info');
jest.spyOn(Logger, 'child').mockReturnValue(Promise.resolve(logger));
const LoggerSetupSpy = jest.spyOn(
LoggerSetup,
'initializePluginLoggers'
);

const cmd = createCommand({
config: './wdio.config.js',
Expand All @@ -247,6 +248,8 @@ describe('Mobile UI Test Run Tests', () => {

await cmd.init();

const loggerSpy = jest.spyOn(cmd.logger, 'info');

try {
await cmd.run();
} catch {
Expand All @@ -255,6 +258,7 @@ describe('Mobile UI Test Run Tests', () => {
// ignore the error
}
expect(loggerSpy).toHaveBeenCalled();
expect(LoggerSetupSpy).toHaveBeenCalled();
});

function createCommand({ config, spec }: NamedParameters): Run {
Expand Down
Loading

0 comments on commit 05f57c3

Please sign in to comment.