Skip to content

Commit

Permalink
fix(xctest): mobileRunXCTest param "args" is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Apr 11, 2023
1 parent 1b8b533 commit 438671f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 18 additions & 10 deletions lib/commands/xctest.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function parseXCTestStdout(stdout) {

// Parse each property
/** @type {XCTestResult} */
const output = /** @type {any} */({});
const output = /** @type {any} */ ({});
let entryIndex = 0;
for (const prop of properties) {
if (entryIndex === 0) {
Expand Down Expand Up @@ -185,7 +185,15 @@ export default {
* @returns {Promise<RunXCUITestResponse>}
* @this {XCUITestDriver}
*/
async mobileRunXCTest(testRunnerBundleId, appUnderTestBundleId, xcTestBundleId, args, testType = 'ui', env, timeout = XCTEST_TIMEOUT) {
async mobileRunXCTest(
testRunnerBundleId,
appUnderTestBundleId,
xcTestBundleId,
args = [],
testType = 'ui',
env,
timeout = XCTEST_TIMEOUT
) {
const subproc = await assertIDB(this.opts).runXCUITest(
testRunnerBundleId,
appUnderTestBundleId,
Expand Down Expand Up @@ -233,7 +241,7 @@ export default {
subproc.on('exit', (code, signal) => {
clearTimeout(xctestTimeout);
if (code !== 0) {
const err = /** @type {any} */(new Error(lastErrorMessage || mostRecentLogObject));
const err = /** @type {any} */ (new Error(lastErrorMessage || mostRecentLogObject));
err.code = code;
if (signal != null) {
err.signal = signal;
Expand Down Expand Up @@ -283,13 +291,13 @@ export default {
},

/**
* List XCTests in a test bundle
*
* @param {string} bundle - Bundle ID of the XCTest
*
* @returns {Promise<string[]>} The list of xctests in the test bundle (e.g., `['XCTesterAppUITests.XCTesterAppUITests/testExample', 'XCTesterAppUITests.XCTesterAppUITests/testLaunchPerformance']`)
* @this {XCUITestDriver}
*/
* List XCTests in a test bundle
*
* @param {string} bundle - Bundle ID of the XCTest
*
* @returns {Promise<string[]>} The list of xctests in the test bundle (e.g., `['XCTesterAppUITests.XCTesterAppUITests/testExample', 'XCTesterAppUITests.XCTesterAppUITests/testLaunchPerformance']`)
* @this {XCUITestDriver}
*/
async mobileListXCTestsInTestBundle(bundle) {
if (!_.isString(bundle)) {
throw new errors.InvalidArgumentError(
Expand Down
4 changes: 2 additions & 2 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ export const executeMethodMap = {
'mobile: runXCTest': {
command: 'mobileRunXCTest',
params: {
required: ['testRunnerBundleId', 'appUnderTestBundleId', 'xcTestBundleId', 'args'],
optional: ['testType', 'env', 'timeout'],
required: ['testRunnerBundleId', 'appUnderTestBundleId', 'xctestBundleId'],
optional: ['args', 'testType', 'env', 'timeout'],
},
},
'mobile: installXCTestBundle': {
Expand Down

0 comments on commit 438671f

Please # to comment.