@e2e-dev/testmu 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ @e2e-dev/testmu
2
+ Copyright 2026 TesterArmy, Inc.
3
+
4
+ This product includes software developed at TesterArmy, Inc.
5
+ (https://tester.army).
package/README.md CHANGED
@@ -1,3 +1,41 @@
1
- # Temporary Holding Version
1
+ # @e2e-dev/testmu
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run `@e2e-dev/mobile` tests on [TestMu AI](https://www.lambdatest.com) (formerly LambdaTest)
4
+ Android emulators, iOS simulators, and real devices. Each worker slot leases one device,
5
+ with your app installed, and releases it when the run ends.
6
+
7
+ ```bash
8
+ npm install --save-dev @e2e-dev/testmu
9
+ ```
10
+
11
+ ```ts title="e2e.config.ts"
12
+ import type { E2EConfig } from 'e2e';
13
+ import { mobile } from '@e2e-dev/mobile';
14
+ import { testmu } from '@e2e-dev/testmu';
15
+
16
+ export default {
17
+ targets: [
18
+ {
19
+ engine: mobile({
20
+ platform: 'android',
21
+ device: testmu({ device: 'Galaxy S22 Ultra 5G', osVersion: '14', app: 'https://example.com/app.apk' }),
22
+ }),
23
+ app: { bundleId: 'com.example.app' },
24
+ },
25
+ ],
26
+ workers: 2,
27
+ } satisfies E2EConfig;
28
+ ```
29
+
30
+ Set `LT_USERNAME` and `LT_ACCESS_KEY` in the run environment, from
31
+ **Account Settings → Password & Security → Username and Access Key**
32
+ ([accounts.lambdatest.com/security/username-accesskey](https://accounts.lambdatest.com/security/username-accesskey)).
33
+ `device` and `osVersion` must match TestMu AI's catalog exactly, and `app` is an
34
+ `lt://` app id, an `https` URL, or a local path. `deviceType: 'real'` picks a real device.
35
+
36
+ See the [integration guide](https://e2e.tester.army/docs/integrations/testmu) for every
37
+ option and the limits.
38
+
39
+ ## License
40
+
41
+ Apache-2.0
@@ -0,0 +1 @@
1
+ {"version":"0.0.0"}
@@ -0,0 +1,6 @@
1
+ export interface TestmuCredentials {
2
+ readonly username: string;
3
+ readonly accessKey: string;
4
+ }
5
+ /** `LT_USERNAME` and `LT_ACCESS_KEY` from the run's environment; throws naming each one that is unset or blank. */
6
+ export declare function testmuCredentials(env: Readonly<Record<string, string | undefined>>): TestmuCredentials;
@@ -0,0 +1,17 @@
1
+ const LT_USERNAME = 'LT_USERNAME';
2
+ const LT_ACCESS_KEY = 'LT_ACCESS_KEY';
3
+ /** `LT_USERNAME` and `LT_ACCESS_KEY` from the run's environment; throws naming each one that is unset or blank. */
4
+ export function testmuCredentials(env) {
5
+ const username = envValue(env, LT_USERNAME);
6
+ const accessKey = envValue(env, LT_ACCESS_KEY);
7
+ if (username === undefined || accessKey === undefined) {
8
+ const missing = [username === undefined ? LT_USERNAME : undefined, accessKey === undefined ? LT_ACCESS_KEY : undefined].filter((name) => name !== undefined);
9
+ throw new Error(`${missing.join(' and ')} ${missing.length === 1 ? 'is' : 'are'} not set; set ${LT_USERNAME} and ${LT_ACCESS_KEY} to your TestMu AI username and access key in the environment \`e2e run\` starts in`);
10
+ }
11
+ return { username, accessKey };
12
+ }
13
+ /** A non-empty variable from the run's environment, trimmed, or `undefined`. */
14
+ function envValue(env, name) {
15
+ const value = env[name]?.trim();
16
+ return value === undefined || value === '' ? undefined : value;
17
+ }
@@ -0,0 +1,12 @@
1
+ import type { DriverGrant, DriverRequest } from './driver.ts';
2
+ export declare function assertDriverVersion(expected: string): void;
3
+ /**
4
+ * Registers the installed `@agent-device/testmu` in a private agent-device
5
+ * home, the layout `agent-device plugins add` writes, without fetching it
6
+ * from the registry again.
7
+ */
8
+ export declare function installPlugin(home: string): Promise<void>;
9
+ /** Not cancellable: an interrupted allocation can still grant a lease, which the caller then releases. */
10
+ export declare function startDriver(request: DriverRequest, env: NodeJS.ProcessEnv): Promise<DriverGrant>;
11
+ /** Stopping the daemon releases its leases, which ends their TestMu AI sessions. */
12
+ export declare function stopDriver(stateDir: string, env: NodeJS.ProcessEnv, signal: AbortSignal): Promise<void>;
package/dist/daemon.js ADDED
@@ -0,0 +1,80 @@
1
+ import { execFile, fork } from 'node:child_process';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { readFileSync } from 'node:fs';
4
+ import { mkdir, symlink, writeFile } from 'node:fs/promises';
5
+ import { fileURLToPath } from 'node:url';
6
+ import path from 'node:path';
7
+ import { promisify } from 'node:util';
8
+ const exec = promisify(execFile);
9
+ const PLUGIN = '@agent-device/testmu';
10
+ /** A property of a parsed JSON value, or undefined when the value is not an object. */
11
+ function field(value, key) {
12
+ return typeof value === 'object' && value !== null ? Reflect.get(value, key) : undefined;
13
+ }
14
+ /** Resolve a dependency's package directory from its entry, without importing it. */
15
+ function installation(name) {
16
+ let directory = path.dirname(fileURLToPath(import.meta.resolve(name)));
17
+ while (true) {
18
+ try {
19
+ const manifest = JSON.parse(readFileSync(path.join(directory, 'package.json'), 'utf8'));
20
+ const version = field(manifest, 'version');
21
+ if (field(manifest, 'name') === name && typeof version === 'string')
22
+ return { directory, version, bin: field(manifest, 'bin') };
23
+ }
24
+ catch { /* The entry may be several directories below its package. */ }
25
+ const parent = path.dirname(directory);
26
+ if (parent === directory)
27
+ throw new Error(`Cannot find the installed ${name} package`);
28
+ directory = parent;
29
+ }
30
+ }
31
+ export function assertDriverVersion(expected) {
32
+ const actual = installation('agent-device').version;
33
+ if (actual !== expected)
34
+ throw new Error(`@e2e-dev/testmu uses agent-device ${actual}, but @e2e-dev/mobile uses ${expected}. Install matching versions.`);
35
+ }
36
+ /**
37
+ * Registers the installed `@agent-device/testmu` in a private agent-device
38
+ * home, the layout `agent-device plugins add` writes, without fetching it
39
+ * from the registry again.
40
+ */
41
+ export async function installPlugin(home) {
42
+ const plugin = installation(PLUGIN);
43
+ const id = randomUUID();
44
+ const scope = path.join(home, 'plugins', id, 'node_modules', '@agent-device');
45
+ await mkdir(scope, { recursive: true, mode: 0o700 });
46
+ await symlink(plugin.directory, path.join(scope, 'testmu'), 'junction');
47
+ await writeFile(path.join(home, 'config.json'), `${JSON.stringify({ plugins: { [PLUGIN]: { installation: id, version: plugin.version } } })}\n`, { mode: 0o600 });
48
+ }
49
+ /** Not cancellable: an interrupted allocation can still grant a lease, which the caller then releases. */
50
+ export async function startDriver(request, env) {
51
+ const entry = new URL(import.meta.url.endsWith('.ts') ? './driver.ts' : './driver.js', import.meta.url);
52
+ return new Promise((resolve, reject) => {
53
+ const child = fork(entry, [], { env, execArgv: [], stdio: ['ignore', 'ignore', 'ignore', 'ipc'] });
54
+ let answered = false;
55
+ child.once('error', reject);
56
+ child.once('message', (reply) => {
57
+ answered = true;
58
+ if (reply.grant)
59
+ resolve(reply.grant);
60
+ else
61
+ reject(new Error(reply.error ?? 'TestMu AI driver returned no lease'));
62
+ });
63
+ child.once('exit', () => {
64
+ if (!answered)
65
+ reject(new Error('TestMu AI driver exited before allocation finished'));
66
+ });
67
+ child.send(request);
68
+ });
69
+ }
70
+ /** Stopping the daemon releases its leases, which ends their TestMu AI sessions. */
71
+ export async function stopDriver(stateDir, env, signal) {
72
+ const cli = installation('agent-device');
73
+ const bin = field(cli.bin, 'agent-device');
74
+ if (typeof bin !== 'string')
75
+ throw new Error('The installed agent-device package has no agent-device bin');
76
+ const { stdout } = await exec(process.execPath, [path.join(cli.directory, bin), 'daemon', 'stop', '--state-dir', stateDir, '--clean', '--json'], { env, signal });
77
+ const pending = field(field(field(JSON.parse(stdout), 'data'), 'providerReleases'), 'pending');
78
+ if (Array.isArray(pending) && pending.length > 0)
79
+ throw new Error(`agent-device stopped without ending ${pending.length} TestMu AI session(s)`);
80
+ }
@@ -0,0 +1,12 @@
1
+ import { type LeaseAllocateOptions } from 'agent-device';
2
+ /** A separate process gives each daemon its own credentials and plugin home without changing the runner's environment. */
3
+ export interface DriverRequest {
4
+ stateDir: string;
5
+ allocate: LeaseAllocateOptions;
6
+ }
7
+ export interface DriverGrant {
8
+ leaseId: string;
9
+ tenantId: string;
10
+ runId: string;
11
+ retainOnClose: boolean;
12
+ }
package/dist/driver.js ADDED
@@ -0,0 +1,8 @@
1
+ import { createAgentDeviceClient } from 'agent-device';
2
+ process.once('message', (request) => {
3
+ void allocate(request).then((grant) => process.send?.({ grant }, () => process.disconnect?.()), (cause) => process.send?.({ error: cause instanceof Error ? cause.message : String(cause) }, () => process.disconnect?.()));
4
+ });
5
+ async function allocate({ stateDir, allocate: options }) {
6
+ const lease = await createAgentDeviceClient({ stateDir }).leases.allocate(options);
7
+ return { leaseId: lease.leaseId, tenantId: lease.tenantId, runId: lease.runId, retainOnClose: lease.retainOnClose === true };
8
+ }
@@ -0,0 +1,4 @@
1
+ import { type LeaseScopedOptions } from 'agent-device';
2
+ export declare const LEASE_TTL_MS = 60000;
3
+ /** Renew idle leases while other targets run; session retention alone does not prevent expiry. */
4
+ export declare function startHeartbeat(stateDir: string, scope: LeaseScopedOptions, log: (line: string) => void): Promise<() => Promise<void>>;
@@ -0,0 +1,34 @@
1
+ import { createAgentDeviceClient } from 'agent-device';
2
+ export const LEASE_TTL_MS = 60_000;
3
+ /** Renew idle leases while other targets run; session retention alone does not prevent expiry. */
4
+ export async function startHeartbeat(stateDir, scope, log) {
5
+ // An explicit empty URL selects the local stateDir instead of an ambient remote daemon.
6
+ const client = createAgentDeviceClient({ stateDir, daemonBaseUrl: '', daemonAuthToken: '', daemonTransport: 'auto' });
7
+ const controller = new AbortController();
8
+ const beat = () => client.leases.heartbeat({ ...scope, ttlMs: LEASE_TTL_MS, signal: AbortSignal.any([controller.signal, AbortSignal.timeout(10_000)]) });
9
+ await beat();
10
+ let pending = Promise.resolve();
11
+ let timer;
12
+ const schedule = () => {
13
+ timer = setTimeout(() => {
14
+ pending = beat().then(() => { }, (error) => {
15
+ if (controller.signal.aborted)
16
+ return;
17
+ try {
18
+ log(`lease ${scope.leaseId}: renewal failed: ${error instanceof Error ? error.message : String(error)}`);
19
+ }
20
+ catch {
21
+ // The run's log may be closed by now.
22
+ }
23
+ }).finally(() => { if (!controller.signal.aborted)
24
+ schedule(); });
25
+ }, 20_000);
26
+ timer.unref();
27
+ };
28
+ schedule();
29
+ return async () => {
30
+ controller.abort();
31
+ clearTimeout(timer);
32
+ await pending;
33
+ };
34
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `@e2e-dev/testmu` public surface: `testmu()`, a device provider that leases
3
+ * TestMu AI (formerly LambdaTest) Android emulators, iOS simulators, and real
4
+ * devices for `@e2e-dev/mobile` through agent-device's `@agent-device/testmu`
5
+ * plugin.
6
+ */
7
+ export { testmu } from './provider.ts';
8
+ export type { TestmuOptions } from './provider.ts';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@e2e-dev/testmu` public surface: `testmu()`, a device provider that leases
3
+ * TestMu AI (formerly LambdaTest) Android emulators, iOS simulators, and real
4
+ * devices for `@e2e-dev/mobile` through agent-device's `@agent-device/testmu`
5
+ * plugin.
6
+ */
7
+ export { testmu } from './provider.js';
@@ -0,0 +1,51 @@
1
+ /**
2
+ * TestMu AI's hosted Android emulators, iOS simulators, and real devices as a
3
+ * `DeviceProvider` for the mobile engine, through agent-device's
4
+ * `@agent-device/testmu` plugin: each lease comes from its own agent-device
5
+ * daemon, which runs the session over TestMu AI's Appium hub.
6
+ */
7
+ import type { DeviceProvider } from '@e2e-dev/mobile';
8
+ /** What `testmu()` takes: the device, its OS version, and the app TestMu AI installs on it. */
9
+ export interface TestmuOptions {
10
+ /** Device name exactly as TestMu AI's catalog lists it: `Galaxy S22 Ultra 5G`, `iPhone 16`. */
11
+ readonly device: string;
12
+ /** OS version exactly as the catalog lists it for that device: `14` on Android, `18.0` on a virtual iOS device, `18` on a real one. */
13
+ readonly osVersion: string;
14
+ /**
15
+ * The build TestMu AI installs on every session: an `lt://` app id, an
16
+ * `https` URL, or a local path, resolved against the project root and
17
+ * uploaded when the lease is allocated.
18
+ */
19
+ readonly app: string;
20
+ /** `'virtual'` (default) for an emulator or simulator, `'real'` for a real device. */
21
+ readonly deviceType?: 'virtual' | 'real' | undefined;
22
+ /** Dashboard project the sessions are grouped under. Defaults to `e2e`. */
23
+ readonly project?: string | undefined;
24
+ /** Dashboard build the sessions are grouped under. Defaults to the run id. */
25
+ readonly build?: string | undefined;
26
+ /**
27
+ * Name of every session on the dashboard, with `-<slot>` appended when the
28
+ * target leases more than one device, so each slot's session has its own.
29
+ * Defaults to `e2e-<run id>-<target>-<slot>`. Slots count from 1.
30
+ */
31
+ readonly sessionName?: string | undefined;
32
+ /** Orientation the device starts in; absent, the device's default. */
33
+ readonly orientation?: 'portrait' | 'landscape' | undefined;
34
+ /** Country the device's IP geolocates to, as a code TestMu AI takes: `US`, `FR`. */
35
+ readonly geoLocation?: string | undefined;
36
+ /** The device's time zone, as TestMu AI takes it: `UTC+05:30`. */
37
+ readonly timezone?: string | undefined;
38
+ /** The device's language, as a language code: `fr`. */
39
+ readonly language?: string | undefined;
40
+ /** The device's locale: `fr_FR`. */
41
+ readonly locale?: string | undefined;
42
+ /** Appium version TestMu AI starts for the session; absent, its default for the device. */
43
+ readonly appiumVersion?: string | undefined;
44
+ }
45
+ /**
46
+ * TestMu AI devices for `mobile({ device: testmu({ device, osVersion, app }) })`:
47
+ * one hosted device and isolated agent-device daemon per worker slot. Allocating
48
+ * the lease starts the TestMu AI session, which installs `app`; releasing it
49
+ * stops the daemon, which ends the session.
50
+ */
51
+ export declare function testmu(options: TestmuOptions): DeviceProvider;
@@ -0,0 +1,221 @@
1
+ /**
2
+ * TestMu AI's hosted Android emulators, iOS simulators, and real devices as a
3
+ * `DeviceProvider` for the mobile engine, through agent-device's
4
+ * `@agent-device/testmu` plugin: each lease comes from its own agent-device
5
+ * daemon, which runs the session over TestMu AI's Appium hub.
6
+ */
7
+ import { mkdtemp, rm } from 'node:fs/promises';
8
+ import { tmpdir } from 'node:os';
9
+ import { isAbsolute, join, resolve } from 'node:path';
10
+ import { ConfigurationError, rejectUnknownKeys } from 'e2e/engine';
11
+ import { testmuCredentials } from './credentials.js';
12
+ import { assertDriverVersion, installPlugin, startDriver, stopDriver } from './daemon.js';
13
+ import { LEASE_TTL_MS, startHeartbeat } from './heartbeat.js';
14
+ import { findSession, sessionVideoUrl, testmuApiEndpoint } from './sessions.js';
15
+ /** agent-device's name for TestMu AI, as the lease provider and the tenant. */
16
+ const PROVIDER = 'testmu';
17
+ /** The dashboard project sessions are grouped under when `project` is absent. */
18
+ const DEFAULT_PROJECT = 'e2e';
19
+ const DEVICE_TYPES = new Set(['virtual', 'real']);
20
+ const ORIENTATIONS = new Set(['portrait', 'landscape']);
21
+ /** Each device-feature option and the agent-device lease key it is allocated under. */
22
+ const DEVICE_FEATURES = {
23
+ orientation: 'providerDeviceOrientation',
24
+ geoLocation: 'providerGeoLocation',
25
+ timezone: 'providerTimezone',
26
+ language: 'providerLanguage',
27
+ locale: 'providerLocale',
28
+ appiumVersion: 'providerAppiumVersion',
29
+ };
30
+ /** The options that are strings when given, checked at config load. */
31
+ const OPTIONAL_STRING_KEYS = ['project', 'build', 'sessionName', ...Object.keys(DEVICE_FEATURES)];
32
+ /** Every option `testmu()` takes, kept equal to `TestmuOptions` by the compiler. */
33
+ const OPTION_KEYS = Object.keys({
34
+ device: true,
35
+ osVersion: true,
36
+ app: true,
37
+ deviceType: true,
38
+ project: true,
39
+ build: true,
40
+ sessionName: true,
41
+ orientation: true,
42
+ geoLocation: true,
43
+ timezone: true,
44
+ language: true,
45
+ locale: true,
46
+ appiumVersion: true,
47
+ });
48
+ function driverEnv(env, home, credentials) {
49
+ const result = { ...env };
50
+ // A user's daemon settings must not select a different daemon or plugin home.
51
+ for (const key of Object.keys(result)) {
52
+ // Keep the user's security policy on both the daemon and its clients.
53
+ if (key === 'AGENT_DEVICE_DAEMON_POLICY')
54
+ continue;
55
+ if (key.startsWith('AGENT_DEVICE_'))
56
+ delete result[key];
57
+ }
58
+ result.AGENT_DEVICE_HOME = home;
59
+ result.LT_USERNAME = credentials.username;
60
+ result.LT_ACCESS_KEY = credentials.accessKey;
61
+ return result;
62
+ }
63
+ /**
64
+ * TestMu AI devices for `mobile({ device: testmu({ device, osVersion, app }) })`:
65
+ * one hosted device and isolated agent-device daemon per worker slot. Allocating
66
+ * the lease starts the TestMu AI session, which installs `app`; releasing it
67
+ * stops the daemon, which ends the session.
68
+ */
69
+ export function testmu(options) {
70
+ rejectUnknownKeys('testmu()', options, OPTION_KEYS);
71
+ for (const key of ['device', 'osVersion', 'app']) {
72
+ const value = options[key];
73
+ if (typeof value !== 'string' || value.trim() === '') {
74
+ throw new ConfigurationError('INVALID_CONFIG', `testmu: \`${key}\` is required, as a non-empty string`);
75
+ }
76
+ }
77
+ // Only an absent value takes the default: `null` from a JavaScript config is refused like any other.
78
+ const deviceType = options.deviceType === undefined ? 'virtual' : options.deviceType;
79
+ if (!DEVICE_TYPES.has(deviceType)) {
80
+ throw new ConfigurationError('INVALID_CONFIG', `testmu: \`deviceType\` must be 'virtual' or 'real', not ${JSON.stringify(deviceType)}`);
81
+ }
82
+ for (const key of OPTIONAL_STRING_KEYS) {
83
+ const value = options[key];
84
+ if (value !== undefined && (typeof value !== 'string' || value.trim() === '')) {
85
+ throw new ConfigurationError('INVALID_CONFIG', `testmu: \`${key}\` must be a non-empty string`);
86
+ }
87
+ }
88
+ if (options.orientation !== undefined && !ORIENTATIONS.has(options.orientation)) {
89
+ throw new ConfigurationError('INVALID_CONFIG', `testmu: \`orientation\` must be 'portrait' or 'landscape', not ${JSON.stringify(options.orientation)}`);
90
+ }
91
+ const deviceFeatures = {};
92
+ for (const [key, leaseKey] of Object.entries(DEVICE_FEATURES)) {
93
+ const value = options[key];
94
+ if (value !== undefined)
95
+ deviceFeatures[leaseKey] = value;
96
+ }
97
+ const { device, osVersion, app, project, build, sessionName } = options;
98
+ const held = new Map();
99
+ /** One release per lease, shared by every caller; a failed one may be tried again. */
100
+ function release(id, resource, signal) {
101
+ resource.releasing ??= (async () => {
102
+ await resource.stopHeartbeat?.();
103
+ await stopDriver(resource.stateDir, resource.env, signal);
104
+ await rm(resource.dir, { recursive: true, force: true });
105
+ if (id !== undefined)
106
+ held.delete(id);
107
+ })();
108
+ resource.releasing.catch(() => { resource.releasing = undefined; });
109
+ return resource.releasing;
110
+ }
111
+ return {
112
+ name: PROVIDER,
113
+ async acquire(request) {
114
+ assertDriverVersion(request.agentDeviceVersion);
115
+ if (request.appPath !== undefined)
116
+ throw new Error("TestMu AI installs the app from `app`; leave the target's `app.appPath` out");
117
+ const credentials = testmuCredentials(request.env);
118
+ request.signal.throwIfAborted();
119
+ const dir = await mkdtemp(join(tmpdir(), 'e2e-testmu-'));
120
+ const home = join(dir, 'home');
121
+ const resource = { dir, stateDir: join(dir, 'state'), env: driverEnv(request.env, home, credentials) };
122
+ const leaseBackend = request.platform === 'ios' ? 'ios-instance' : 'android-instance';
123
+ const selectors = {
124
+ platform: request.platform,
125
+ target: 'mobile',
126
+ device,
127
+ providerOsVersion: osVersion,
128
+ providerApp: appSource(app, request.projectRoot),
129
+ providerDeviceType: deviceType,
130
+ providerProject: project ?? DEFAULT_PROJECT,
131
+ providerBuild: build ?? request.runId,
132
+ providerSessionName: slotSessionName(sessionName, request),
133
+ ...deviceFeatures,
134
+ };
135
+ let id;
136
+ try {
137
+ await installPlugin(home);
138
+ const grant = await startDriver({
139
+ stateDir: resource.stateDir,
140
+ allocate: {
141
+ tenant: PROVIDER,
142
+ runId: request.runId,
143
+ leaseBackend,
144
+ leaseProvider: PROVIDER,
145
+ ttlMs: LEASE_TTL_MS,
146
+ // The engine closes a worker's session when it retires the worker; without this, closing it ends the TestMu AI session mid-run.
147
+ retainOnClose: true,
148
+ ...selectors,
149
+ },
150
+ }, resource.env);
151
+ id = grant.leaseId;
152
+ held.set(id, resource);
153
+ if (request.signal.aborted)
154
+ throw new Error('cancelled');
155
+ if (!grant.retainOnClose)
156
+ throw new Error('agent-device did not keep the lease through session close, so the session would end when a worker retires');
157
+ const scope = { tenant: grant.tenantId, runId: grant.runId, leaseId: grant.leaseId, leaseBackend, leaseProvider: PROVIDER };
158
+ resource.stopHeartbeat = await startHeartbeat(resource.stateDir, scope, request.log);
159
+ request.log(`lease ${id}: ${device}, ${request.platform} ${osVersion} (${deviceType}); session ${selectors.providerSessionName} started`);
160
+ // The worker's client is created with these fields: the scope picks the lease, and the selectors match the session it holds.
161
+ return { id, client: { stateDir: resource.stateDir, ...scope, ...selectors } };
162
+ }
163
+ catch (cause) {
164
+ // The engine releases only leases `acquire` returned.
165
+ try {
166
+ await release(id, resource, AbortSignal.timeout(30_000));
167
+ }
168
+ catch (cleanup) {
169
+ throw new AggregateError([cause, cleanup], `TestMu AI lease failed: ${messageOf(cause)}; cleanup also failed: ${messageOf(cleanup)}`, { cause: cleanup });
170
+ }
171
+ throw cause;
172
+ }
173
+ },
174
+ async release(lease, context) {
175
+ const resource = held.get(lease.id);
176
+ if (resource)
177
+ await release(lease.id, resource, context.signal);
178
+ },
179
+ // Runs in the worker, from the lease alone. TestMu AI records the whole session, so its video starts when the session did.
180
+ async record(lease, context) {
181
+ const calledAt = new Date().toISOString();
182
+ const session = sessionRef(lease);
183
+ if (session === undefined)
184
+ throw new Error(`lease ${lease.id} carries no TestMu AI build and session name to find its recording by`);
185
+ const credentials = testmuCredentials(context.env);
186
+ const endpoint = testmuApiEndpoint(context.env);
187
+ const found = await findSession(endpoint, credentials, session, context.signal);
188
+ return {
189
+ // Without a usable start time from TestMu AI, the moment recording was asked for is the closest known bound.
190
+ startedAt: found.startedAt ?? calledAt,
191
+ stop: async ({ signal }) => ({ url: await sessionVideoUrl(endpoint, credentials, found.id, session, signal), mediaType: 'video/mp4' }),
192
+ };
193
+ },
194
+ };
195
+ }
196
+ /**
197
+ * The dashboard name of a slot's session, unique among the run's slots of the
198
+ * target so `record` can find the session by it within its build.
199
+ */
200
+ function slotSessionName(sessionName, { runId, targetName, slot, slots }) {
201
+ if (sessionName === undefined)
202
+ return `e2e-${runId}-${targetName}-${slot + 1}`;
203
+ return slots > 1 ? `${sessionName}-${slot + 1}` : sessionName;
204
+ }
205
+ /** `app` as the daemon reads it: an `lt://` id or URL as written, a local path resolved against the project root, never the daemon's working directory. */
206
+ function appSource(app, projectRoot) {
207
+ if (isAbsolute(app) || /^[a-z][a-z0-9+.-]*:\/\//i.test(app))
208
+ return app;
209
+ return resolve(projectRoot, app);
210
+ }
211
+ /** The build and session name `acquire` put on a lease's `client`, when they are there. */
212
+ function sessionRef({ client }) {
213
+ const build = client?.providerBuild;
214
+ const sessionName = client?.providerSessionName;
215
+ if (typeof build !== 'string' || build === '' || typeof sessionName !== 'string' || sessionName === '')
216
+ return undefined;
217
+ return { build, sessionName };
218
+ }
219
+ function messageOf(cause) {
220
+ return cause instanceof Error ? cause.message : String(cause);
221
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * TestMu AI's mobile automation sessions API over `fetch`, the one
3
+ * agent-device's `@agent-device/testmu` plugin reads session artifacts from: finds a
4
+ * session by its build and name, with its start time, and reads the URL of
5
+ * its video.
6
+ */
7
+ import type { TestmuCredentials } from './credentials.ts';
8
+ /** A session the recording covers, as the lease named it. */
9
+ export interface SessionRef {
10
+ readonly build: string;
11
+ readonly sessionName: string;
12
+ }
13
+ /**
14
+ * The sessions API at `TESTMU_API_ENDPOINT` from the run's environment, else
15
+ * TestMu AI's own. Throws, without repeating the value, when the override is
16
+ * not an http(s) URL or carries a username or password, which a failed
17
+ * request would otherwise put in its error message.
18
+ */
19
+ export declare function testmuApiEndpoint(env: Readonly<Record<string, string | undefined>>): string;
20
+ /** A session the list found: its `test_id`, and when it started, if the list says. */
21
+ export interface FoundSession {
22
+ readonly id: string;
23
+ /** ISO timestamp in UTC; `undefined` when the row has no start time or one that does not parse. */
24
+ readonly startedAt: string | undefined;
25
+ }
26
+ /**
27
+ * The newest session named `sessionName` in `build` that the credentials'
28
+ * user started, reading the list a page at a time. Every request is bounded by `REQUEST_TIMEOUT_MS` and `signal`,
29
+ * and errors name the build and the session, never the credentials or a URL.
30
+ */
31
+ export declare function findSession(endpoint: string, credentials: TestmuCredentials, { build, sessionName }: SessionRef, signal: AbortSignal): Promise<FoundSession>;
32
+ /** The `video_url` of session `id`'s details, bounded and named as `findSession` is. */
33
+ export declare function sessionVideoUrl(endpoint: string, credentials: TestmuCredentials, id: string, { build, sessionName }: SessionRef, signal: AbortSignal): Promise<string>;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * TestMu AI's mobile automation sessions API over `fetch`, the one
3
+ * agent-device's `@agent-device/testmu` plugin reads session artifacts from: finds a
4
+ * session by its build and name, with its start time, and reads the URL of
5
+ * its video.
6
+ */
7
+ import { ConfigurationError } from 'e2e/engine';
8
+ /** The API's base, as agent-device's `TESTMU_API_ENDPOINT` sets it. */
9
+ const DEFAULT_API_ENDPOINT = 'https://mobile-api.lambdatest.com/mobile-automation/api/v1';
10
+ const REQUEST_TIMEOUT_MS = 15_000;
11
+ /** Sessions the list asks for at once. */
12
+ const PAGE_SIZE = 50;
13
+ /** Pages the lookup reads before it gives up on a build: the list is newest first, so the session is near the top. */
14
+ const MAX_PAGES = 10;
15
+ /**
16
+ * The sessions API at `TESTMU_API_ENDPOINT` from the run's environment, else
17
+ * TestMu AI's own. Throws, without repeating the value, when the override is
18
+ * not an http(s) URL or carries a username or password, which a failed
19
+ * request would otherwise put in its error message.
20
+ */
21
+ export function testmuApiEndpoint(env) {
22
+ const override = env['TESTMU_API_ENDPOINT']?.trim();
23
+ if (override === undefined || override === '')
24
+ return DEFAULT_API_ENDPOINT;
25
+ if (!URL.canParse(override) || !/^https?:$/.test(new URL(override).protocol))
26
+ throw new ConfigurationError('INVALID_CONFIG', 'TESTMU_API_ENDPOINT is not an http(s) URL');
27
+ const url = new URL(override);
28
+ if (url.username !== '' || url.password !== '') {
29
+ throw new ConfigurationError('INVALID_CONFIG', 'TESTMU_API_ENDPOINT must not carry a username or password; set LT_USERNAME and LT_ACCESS_KEY instead');
30
+ }
31
+ return override.replace(/\/+$/, '');
32
+ }
33
+ /**
34
+ * The newest session named `sessionName` in `build` that the credentials'
35
+ * user started, reading the list a page at a time. Every request is bounded by `REQUEST_TIMEOUT_MS` and `signal`,
36
+ * and errors name the build and the session, never the credentials or a URL.
37
+ */
38
+ export async function findSession(endpoint, credentials, { build, sessionName }, signal) {
39
+ const auth = basicAuth(credentials);
40
+ const what = `TestMu AI session lookup for build ${JSON.stringify(build)}`;
41
+ for (let page = 0; page < MAX_PAGES; page += 1) {
42
+ const url = new URL(`${endpoint}/sessions`);
43
+ url.searchParams.set('build', build);
44
+ // The build filter spans the whole organization; a build name another user's run shares would find their session.
45
+ url.searchParams.set('username', credentials.username);
46
+ url.searchParams.set('limit', String(PAGE_SIZE));
47
+ url.searchParams.set('offset', String(page * PAGE_SIZE));
48
+ const body = await getJson(url, auth, signal, what);
49
+ // An empty page comes back as `data: null`.
50
+ const rows = body['data'] ?? [];
51
+ if (!Array.isArray(rows))
52
+ throw new Error(`${what} failed: no session list in the response`);
53
+ for (const row of rows) {
54
+ const { name, test_id: id, start_timestamp: start } = asRecord(row) ?? {};
55
+ if (name === sessionName && typeof id === 'string' && id !== '')
56
+ return { id, startedAt: utcTimestamp(start) };
57
+ }
58
+ if (rows.length < PAGE_SIZE)
59
+ break;
60
+ }
61
+ throw new Error(`TestMu AI has no session named ${JSON.stringify(sessionName)} in build ${JSON.stringify(build)}`);
62
+ }
63
+ /** The `video_url` of session `id`'s details, bounded and named as `findSession` is. */
64
+ export async function sessionVideoUrl(endpoint, credentials, id, { build, sessionName }, signal) {
65
+ const what = `TestMu AI session ${id} (${JSON.stringify(sessionName)}, build ${JSON.stringify(build)})`;
66
+ const body = await getJson(new URL(`${endpoint}/sessions/${encodeURIComponent(id)}`), basicAuth(credentials), signal, `${what} details`);
67
+ const details = asRecord(body['data']);
68
+ const videoUrl = details?.['video_url'];
69
+ if (typeof videoUrl !== 'string' || !isHttpUrl(videoUrl))
70
+ throw new Error(`${what} reports no video URL`);
71
+ return videoUrl;
72
+ }
73
+ const TIMESTAMP = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}:\d{2}(?:\.\d+)?)(Z|[+-]\d{2}:\d{2})?$/;
74
+ /**
75
+ * A `start_timestamp` as an ISO timestamp in UTC. The API formats the
76
+ * database time as RFC 3339 with its zone; a time without one is read as UTC,
77
+ * the zone the API's database driver reads it in.
78
+ */
79
+ function utcTimestamp(value) {
80
+ if (typeof value !== 'string')
81
+ return undefined;
82
+ const match = TIMESTAMP.exec(value.trim());
83
+ if (match === null)
84
+ return undefined;
85
+ const [, date, time, zone] = match;
86
+ const ms = Date.parse(`${date}T${time}${zone ?? 'Z'}`);
87
+ return Number.isNaN(ms) ? undefined : new Date(ms).toISOString();
88
+ }
89
+ function basicAuth({ username, accessKey }) {
90
+ return `Basic ${Buffer.from(`${username}:${accessKey}`).toString('base64')}`;
91
+ }
92
+ /** One authenticated GET answered with a JSON object; anything else throws, as `what`, with the HTTP status and the API's message. */
93
+ async function getJson(url, auth, signal, what) {
94
+ const timeout = new AbortController();
95
+ const timer = setTimeout(() => timeout.abort(), REQUEST_TIMEOUT_MS);
96
+ let response;
97
+ let text;
98
+ try {
99
+ response = await fetch(url, { headers: { Authorization: auth, Accept: 'application/json' }, signal: AbortSignal.any([signal, timeout.signal]) });
100
+ text = await response.text();
101
+ }
102
+ catch (cause) {
103
+ if (signal.aborted)
104
+ throw new Error(`${what} cancelled`, { cause });
105
+ if (timeout.signal.aborted)
106
+ throw new Error(`${what} got no answer within ${REQUEST_TIMEOUT_MS / 1000} s`, { cause });
107
+ throw new Error(`${what} failed: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
108
+ }
109
+ finally {
110
+ clearTimeout(timer);
111
+ }
112
+ let body;
113
+ try {
114
+ body = asRecord(JSON.parse(text));
115
+ }
116
+ catch {
117
+ body = undefined;
118
+ }
119
+ if (body === undefined)
120
+ throw new Error(`${what} failed: HTTP ${response.status}, not JSON`);
121
+ if (!response.ok) {
122
+ const message = body['message'];
123
+ throw new Error(`${what} failed: HTTP ${response.status}${typeof message === 'string' && message !== '' ? ` (${message.slice(0, 200)})` : ''}`);
124
+ }
125
+ return body;
126
+ }
127
+ function asRecord(value) {
128
+ return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
129
+ }
130
+ function isHttpUrl(value) {
131
+ return URL.canParse(value) && /^https?:$/.test(new URL(value).protocol);
132
+ }
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@e2e-dev/testmu",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "TestMu AI (formerly LambdaTest) hosted Android emulators, iOS simulators, and real devices for e2e mobile tests",
5
+ "keywords": [
6
+ "e2e",
7
+ "end-to-end",
8
+ "testing",
9
+ "mobile-testing",
10
+ "testmu",
11
+ "lambdatest",
12
+ "device-cloud",
13
+ "real-devices",
14
+ "ios-simulator",
15
+ "android-emulator",
16
+ "agent-device",
17
+ "ci"
18
+ ],
19
+ "license": "Apache-2.0",
20
+ "contributors": [
21
+ "Aman Kansal (https://github.com/amankansal-lt)"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/tester-army/e2e.git",
26
+ "directory": "packages/testmu"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/tester-army/e2e/issues"
30
+ },
31
+ "homepage": "https://github.com/tester-army/e2e/tree/main/packages/testmu#readme",
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org/",
34
+ "access": "public",
35
+ "tag": "latest"
36
+ },
37
+ "type": "module",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "default": "./dist/index.js"
42
+ }
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "NOTICE"
47
+ ],
48
+ "peerDependencies": {
49
+ "@e2e-dev/mobile": ">=0.11.1 <1",
50
+ "e2e": ">=0.15.0 <1"
51
+ },
52
+ "devDependencies": {
53
+ "@e2e-dev/mobile": "0.12.2",
54
+ "@types/node": "26.6.2",
55
+ "e2e": "0.21.1",
56
+ "typescript": "7.0.2",
57
+ "vitest": "5.0.1"
58
+ },
59
+ "engines": {
60
+ "node": "^22.22.3 || >=24.8.0"
61
+ },
62
+ "dependencies": {
63
+ "@agent-device/testmu": "0.21.28",
64
+ "agent-device": "0.21.28"
65
+ },
66
+ "scripts": {
67
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && node ../../scripts/stamp-dist.ts",
68
+ "typecheck": "tsc --noEmit",
69
+ "test": "vitest run",
70
+ "test:watch": "vitest",
71
+ "test:unit": "vitest run tests/unit"
72
+ }
6
73
  }