Skip to content

Commit

Permalink
fix webos nosdk error when run sim
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius456 committed Sep 11, 2024
1 parent c1d0b69 commit c741296
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 0 additions & 5 deletions packages/sdk-webos/src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ describe('checkAndConfigureWebosSdks', () => {
// GIVEN
const mockContext = {
platform: 'webos',
// buildConfig: {
// sdks: {
// WEBOS_SDK: '/path/to/sdk',
// },
// },
cli: {},
};
(core.getContext as jest.Mock).mockReturnValue(mockContext);
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-webos/src/__tests__/deviceManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ describe('launchWebOSimulator', () => {
//GIVEN
const ctx = getContext();
ctx.platform = 'webos';
ctx.paths.workspace.config = '/path/test';
ctx.paths.workspace.config = '/path/test/renative';
const target = true;
const errorMessage = `Your webos SDK path is not configured. Please update your /path/test file`;
const errorMessage = `Your webos SDK path is not configured. If you want to run simulator please update your /path/test/renative file with simulator path.`;

jest.mocked(getRealPath).mockReturnValue(undefined);

Expand Down
14 changes: 9 additions & 5 deletions packages/sdk-webos/src/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
getConfigProp,
getAppFolder,
getContext,
logError,
} from '@rnv/core';
import { WebosDevice } from './types';
import {
Expand All @@ -40,7 +41,7 @@ export const launchWebOSimulator = async (target: string | boolean) => {
if (!webosSdkPath) {
return Promise.reject(
`Your ${c.platform} SDK path is not configured. Please update your ${c.paths.workspace.config} file`
);
);
}
const availableSimulatorVersions = getDirectories(path.join(webosSdkPath, 'Simulator'));

Expand Down Expand Up @@ -132,10 +133,9 @@ const launchAppOnSimulator = async (c: RnvContext, appPath: string) => {

const webosSdkPath = getRealPath(c.buildConfig?.sdks?.WEBOS_SDK);


if (!webosSdkPath) {
return Promise.reject(
`Your ${c.platform} SDK path is not configured. Please update your ${c.paths.workspace.config} file`
`Your ${c.platform} SDK path is not configured. If you want to run simulator please update your ${c.paths.workspace.config} file with simulator path.`
);
}

Expand Down Expand Up @@ -227,7 +227,7 @@ export const listWebOSTargets = async () => {
if (!webosSdkPath) {
return Promise.reject(
`Your ${c.platform} SDK path is not configured. Please update your ${c.paths.workspace.config} file`
);
);
}
const availableSimulatorVersions = getDirectories(path.join(webosSdkPath, 'Simulator'));
availableSimulatorVersions.map((a) => {
Expand Down Expand Up @@ -333,7 +333,11 @@ export const runWebosSimOrDevice = async () => {
return installAndLaunchApp(response.chosenDevice, appPath, tId);
}
} else {
return launchAppOnSimulator(c, appLocation);
try {
return await launchAppOnSimulator(c, appLocation);
} catch (error) {
return logError(`${error}`);
}
}
} else {
// Target specified, using that
Expand Down

0 comments on commit c741296

Please sign in to comment.