chore: Enable strict TS mode#1064
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Enables TypeScript strict mode across the project and updates library code plus unit tests to satisfy stricter type-checking (including more accurate async stubbing and improved error handling).
Changes:
- Turned on
compilerOptions.strictintsconfig.jsonand added missing type dependencies. - Updated driver/command modules for stricter typing (type-only imports, explicit
thistyping, improved error wrapping, tighter argument validation). - Updated unit tests to use typed variables and async-aware Sinon stubs (
resolves/Promise.resolve) consistent with the underlying async APIs.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Enables strict TypeScript checking for lib and test. |
| package.json | Updates dependencies and adds missing @types/* packages needed for strict-mode compilation. |
| lib/execute-method-map.ts | Converts import to type-only to avoid runtime import when only types are needed. |
| lib/driver.ts | Adjusts imports and class fields for strict property initialization; improves logcat-stop error message formatting. |
| lib/commands/types.ts | Makes timing a type-only import used for type definitions. |
| lib/commands/system-bars.ts | Wraps shell failures with an Error including a cause. |
| lib/commands/shell.ts | Adds an explicit this: AndroidDriver annotation for stricter typing. |
| lib/commands/resources.ts | Adds cause when rethrowing errors to preserve underlying failures. |
| lib/commands/recordscreen.ts | Adds cause when rethrowing background-recording termination errors. |
| lib/commands/permissions.ts | Adds validation to require appPackage before changing permissions. |
| lib/commands/performance.ts | Adjusts typing for cpuinfo return shape and removes redundant parsing assignment. |
| lib/commands/network.ts | Refactors service-selection logic to be more type-friendly under strict mode. |
| test/unit/commands/webview-helper-specs.ts | Adds explicit string[] typing and makes shell stubs async-resolving. |
| test/unit/commands/recordscreen-specs.ts | Uses resolves for async getApiLevel stub. |
| test/unit/commands/performance-specs.ts | Makes stubs async-resolving and tightens stub typing for strict mode. |
| test/unit/commands/network-specs.ts | Converts various ADB/driver stubs to async resolves and aligns expected types. |
| test/unit/commands/log-specs.ts | Uses LogEntry typing and async getLogcatLogs stubbing. |
| test/unit/commands/lock-specs.ts | Adds capability typing, converts relevant stubs to async, and adjusts helper typings for strict mode. |
| test/unit/commands/ime-specs.ts | Converts ADB/driver stubs to async resolves where appropriate. |
| test/unit/commands/geolocation-specs.ts | Converts ADB shell stub to async resolves. |
| test/unit/commands/file-actions-specs.ts | Converts temp/fs/util stubs to async resolves to match awaited production code. |
| test/unit/commands/device-specs.ts | Makes ADB.createADB stub async, and updates emulator-related stubs to async. |
| test/unit/commands/context-specs.ts | Uses a real ADB instance, async stubs for helpers, and updates setupNewChromedriver calls to pass device id. |
| test/unit/commands/app-management-specs.ts | Converts ADB/fs stubs to async resolves to match awaited production code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+41
to
+46
| throw new Error( | ||
| `Cannot retrieve system bars details. Original error: ${(e as Error).message}`, | ||
| { | ||
| cause: e, | ||
| }, | ||
| ); |
| return true; | ||
| } catch (err) { | ||
| throw new Error(`Unable to stop the background screen recording: ${(err as Error).message}`); | ||
| throw new Error(`Unable to stop the background screen recording: ${(err as Error).message}`, { |
Comment on lines
93
to
97
| case 'batteryinfo': | ||
| return await getBatteryInfo.call(this, retries); | ||
| case 'cpuinfo': | ||
| return await getCPUInfo.call(this, packageName, retries); | ||
| return (await getCPUInfo.call(this, packageName, retries)) as any[][]; | ||
| case 'memoryinfo': |
Contributor
Author
There was a problem hiding this comment.
I don't want to change it as part of this PR
KazuCocoa
approved these changes
May 9, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
May 9, 2026
## [13.2.2](v13.2.1...v13.2.2) (2026-05-09) ### Miscellaneous Chores * Enable strict TS mode ([#1064](#1064)) ([f51578d](f51578d))
|
🎉 This PR is included in version 13.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.