@e2e-dev/eas 0.1.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/eas
2
+ Copyright 2026 TesterArmy, Inc.
3
+
4
+ This product includes software developed at TesterArmy, Inc.
5
+ (https://tester.army).
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @e2e-dev/eas
2
+
3
+ [EAS Simulators](https://expo.dev/services/simulators) for [`e2e`](https://www.npmjs.com/package/e2e):
4
+ `mobile({ device: easSimulators({ projectId }) })` runs a mobile target on
5
+ Expo's hosted iOS simulators and Android emulators.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save-dev @e2e-dev/eas
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts title="e2e.config.ts"
16
+ import type { E2EConfig } from 'e2e';
17
+ import { mobile } from '@e2e-dev/mobile';
18
+ import { easSimulators } from '@e2e-dev/eas';
19
+
20
+ export default {
21
+ targets: [
22
+ {
23
+ engine: mobile({
24
+ platform: 'ios',
25
+ device: easSimulators({ projectId: '<expo project id>', buildId: process.env.EAS_BUILD_ID }),
26
+ videoTouches: false,
27
+ }),
28
+ app: { bundleId: 'com.example.app' },
29
+ },
30
+ ],
31
+ workers: 2,
32
+ } satisfies E2EConfig;
33
+ ```
34
+
35
+ `EXPO_TOKEN` comes from the run's environment. Each worker slot gets its own
36
+ EAS Simulators session, started when the run starts and stopped when it ends,
37
+ and the engine drives it through the agent-device daemon EAS runs beside it.
38
+ Tests start once every slot has a simulator.
39
+
40
+ - `buildId` (or `applicationArchiveUrl`) has EAS install the app; without
41
+ it, `device.installApp()` uploads the target's `app.appPath` through the
42
+ daemon.
43
+ - `device` picks the simulator.
44
+ - `maxIdleTimeMinutes` (default 10) is how long EAS keeps a session no
45
+ command reached, the backstop for a run that died.
46
+ - `maxDurationMinutes` caps a session's life (40 minutes by default, 115 on
47
+ a high-priority plan), so a run must fit in it.
48
+ - `agentDeviceVersion` is the agent-device EAS starts, by default the one
49
+ `@e2e-dev/mobile` pins.
50
+ - `tags` are added to the run's own.
51
+
52
+ Set the engine's `videoTouches: false` for video: drawing touches into a
53
+ recording on an EAS iOS simulator outlasts the attempt's cleanup. The package
54
+ calls Expo's API with `fetch`, so there is no SDK to install.
55
+
56
+ Full documentation lives at [e2e.tester.army/docs/integrations/eas](https://e2e.tester.army/docs/integrations/eas).
57
+
58
+ ## License
59
+
60
+ Apache-2.0
@@ -0,0 +1 @@
1
+ {"version":"0.1.0"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * EAS Simulators' sessions through Expo's GraphQL API over `fetch`, the API
3
+ * `eas simulator:*` uses, so the integration installs no SDK.
4
+ */
5
+ /** What the provider asks EAS for: one agent-device session on one platform. */
6
+ export interface EasSessionParams {
7
+ readonly appId: string;
8
+ readonly platform: 'ios' | 'android';
9
+ readonly name: string;
10
+ readonly tags: readonly string[];
11
+ readonly buildId?: string | undefined;
12
+ readonly applicationArchiveUrl?: string | undefined;
13
+ /** An iOS device name or UDID, or an Android AVD hardware profile. */
14
+ readonly deviceIdentifier?: string | undefined;
15
+ readonly maxIdleTimeMinutes?: number | undefined;
16
+ readonly maxRunTimeMinutes?: number | undefined;
17
+ /** The agent-device version EAS starts the daemon at. */
18
+ readonly packageVersion?: string | undefined;
19
+ }
20
+ /** Where a session is: `queued` until the account has a free simulator, `starting` while it boots, `ready` once its daemon is reachable. */
21
+ export type EasSessionState = {
22
+ readonly phase: 'queued' | 'starting';
23
+ } | {
24
+ readonly phase: 'ready';
25
+ readonly daemonUrl: string;
26
+ readonly daemonToken: string;
27
+ /** The browser preview, when it opens without a token; a gated one is left out so its token stays out of logs. */
28
+ readonly openPreviewUrl: string | undefined;
29
+ } | {
30
+ readonly phase: 'ended';
31
+ readonly status: string;
32
+ };
33
+ export interface EasCreatedSession {
34
+ readonly id: string;
35
+ /** The session's page on expo.dev. */
36
+ readonly url: string;
37
+ }
38
+ export interface EasSessions {
39
+ create(params: EasSessionParams, signal: AbortSignal): Promise<EasCreatedSession>;
40
+ state(id: string, signal: AbortSignal): Promise<EasSessionState>;
41
+ /**
42
+ * Stops the session, and cancels its job when it is still queued: a stopped
43
+ * session's queued job still starts later and holds one of the account's
44
+ * concurrent sessions while it does. Stopping one already stopped, or one
45
+ * EAS no longer knows, succeeds.
46
+ */
47
+ stop(id: string, signal: AbortSignal): Promise<void>;
48
+ }
49
+ /** EAS Simulators sessions for one Expo access token. */
50
+ export declare function easSessions(token: string): EasSessions;
51
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpD,sEAAsE;IACtE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,yDAAyD;IACzD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,4IAA4I;AAC5I,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,GACzC;IACE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,kHAAkH;IAClH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C,GACD;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClF,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACjE;;;;;OAKG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AA2CD,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CA2DtD"}
package/dist/client.js ADDED
@@ -0,0 +1,103 @@
1
+ /**
2
+ * EAS Simulators' sessions through Expo's GraphQL API over `fetch`, the API
3
+ * `eas simulator:*` uses, so the integration installs no SDK.
4
+ */
5
+ const GRAPHQL_URL = 'https://api.expo.dev/graphql';
6
+ const CREATE = `mutation ($input: CreateDeviceRunSessionInput!) {
7
+ deviceRunSession { createDeviceRunSession(deviceRunSessionInput: $input) { id app { slug ownerAccount { name } } } }
8
+ }`;
9
+ const STATE = `query ($id: ID!) {
10
+ deviceRunSessions { byId(deviceRunSessionId: $id) {
11
+ status
12
+ turtleJobRun { status }
13
+ remoteConfig { ... on AgentDeviceRunSessionRemoteConfig { agentDeviceRemoteSessionUrl agentDeviceRemoteSessionToken webPreviewUrl webPreviewToken } }
14
+ } }
15
+ }`;
16
+ const STOP = `mutation ($id: ID!) {
17
+ deviceRunSession { ensureDeviceRunSessionStopped(deviceRunSessionId: $id) { turtleJobRun { id status } } }
18
+ }`;
19
+ const CANCEL_JOB = `mutation ($id: ID!) {
20
+ jobRun { cancelJobRun(jobRunId: $id) { id } }
21
+ }`;
22
+ /** Job run states before the job picks the session up: waiting for the account's concurrency. */
23
+ const QUEUED_JOB = new Set(['NEW', 'IN_QUEUE']);
24
+ /** Job run states after which the session never becomes ready. */
25
+ const ENDED_JOB = new Set(['ERRORED', 'CANCELED', 'FINISHED', 'PENDING_CANCEL']);
26
+ /** EAS Simulators sessions for one Expo access token. */
27
+ export function easSessions(token) {
28
+ /** Runs one operation; a GraphQL error throws with EAS's message and error code. */
29
+ const graphql = async (query, variables, signal) => {
30
+ const response = await fetch(GRAPHQL_URL, {
31
+ method: 'POST',
32
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
33
+ body: JSON.stringify({ query, variables }),
34
+ signal,
35
+ });
36
+ const text = await response.text();
37
+ let body;
38
+ try {
39
+ body = JSON.parse(text);
40
+ }
41
+ catch {
42
+ throw new Error(`EAS: HTTP ${response.status}, ${text.trim().slice(0, 200)}`);
43
+ }
44
+ const error = body.errors?.[0];
45
+ if (error !== undefined)
46
+ throw new EasError(error.message ?? `HTTP ${response.status}`, error.extensions?.errorCode);
47
+ if (!response.ok || body.data == null)
48
+ throw new Error(`EAS: HTTP ${response.status}, no data`);
49
+ return body.data;
50
+ };
51
+ return {
52
+ async create({ platform, deviceIdentifier, ...fields }, signal) {
53
+ const input = {
54
+ ...fields,
55
+ platform: platform.toUpperCase(),
56
+ type: 'AGENT_DEVICE',
57
+ ...(deviceIdentifier === undefined ? {} : { [platform]: { deviceIdentifier } }),
58
+ };
59
+ const data = await graphql(CREATE, { input }, signal);
60
+ const { id, app } = data.deviceRunSession.createDeviceRunSession;
61
+ return { id, url: `https://expo.dev/accounts/${encodeURIComponent(app.ownerAccount.name)}/projects/${encodeURIComponent(app.slug)}/simulator-sessions/${id}` };
62
+ },
63
+ async state(id, signal) {
64
+ const data = await graphql(STATE, { id }, signal);
65
+ const session = data.deviceRunSessions.byId;
66
+ const job = session.turtleJobRun?.status;
67
+ const config = session.remoteConfig;
68
+ if (session.status === 'STOPPED' || session.status === 'ERRORED')
69
+ return { phase: 'ended', status: session.status.toLowerCase() };
70
+ // A job that ended keeps the daemon address it had, which no longer answers.
71
+ if (job !== undefined && ENDED_JOB.has(job))
72
+ return { phase: 'ended', status: `job ${job.toLowerCase()}` };
73
+ if (config?.agentDeviceRemoteSessionUrl !== undefined && config.agentDeviceRemoteSessionToken !== undefined) {
74
+ const openPreviewUrl = config.webPreviewToken == null ? (config.webPreviewUrl ?? undefined) : undefined;
75
+ return { phase: 'ready', daemonUrl: config.agentDeviceRemoteSessionUrl, daemonToken: config.agentDeviceRemoteSessionToken, openPreviewUrl };
76
+ }
77
+ return { phase: job === undefined || QUEUED_JOB.has(job) ? 'queued' : 'starting' };
78
+ },
79
+ async stop(id, signal) {
80
+ let job;
81
+ try {
82
+ const data = await graphql(STOP, { id }, signal);
83
+ job = data.deviceRunSession.ensureDeviceRunSessionStopped.turtleJobRun;
84
+ }
85
+ catch (cause) {
86
+ if (cause instanceof EasError && cause.code === 'NOT_FOUND_ERROR')
87
+ return;
88
+ throw cause;
89
+ }
90
+ if (job !== null && QUEUED_JOB.has(job.status))
91
+ await graphql(CANCEL_JOB, { id: job.id }, signal);
92
+ },
93
+ };
94
+ }
95
+ /** An error EAS answered with, its `errorCode` kept. */
96
+ class EasError extends Error {
97
+ code;
98
+ constructor(message, code) {
99
+ super(`EAS: ${message}`);
100
+ this.code = code;
101
+ }
102
+ }
103
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAgDnD,MAAM,MAAM,GAAG;;EAEb,CAAC;AAEH,MAAM,KAAK,GAAG;;;;;;EAMZ,CAAC;AAEH,MAAM,IAAI,GAAG;;EAEX,CAAC;AAEH,MAAM,UAAU,GAAG;;EAEjB,CAAC;AAkBH,iGAAiG;AACjG,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AAChD,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEjF,yDAAyD;AACzD,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,oFAAoF;IACpF,MAAM,OAAO,GAAG,KAAK,EAAK,KAAa,EAAE,SAAkC,EAAE,MAAmB,EAAc,EAAE;QAC9G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,EAAE;YACxC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YACjF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;YAC1C,MAAM;SACP,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,IAA2D,CAAC;QAChE,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,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AC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACrF,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM;YACnB,IAAI,GAA0C,CAAC;YAC/C,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAmH,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;gBACnK,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,YAAY,CAAC;YACzE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;oBAAE,OAAO;gBAC1E,MAAM,KAAK,CAAC;YACd,CAAC;YACD,IAAI,GAAG,KAAK,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,MAAM,OAAO,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QACpG,CAAC;KACF,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,QAAS,SAAQ,KAAK;IAGf,IAAI;IAFf,YACE,OAAe,EACN,IAAwB;QAEjC,KAAK,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC;oBAFhB,IAAI;IAGf,CAAC;CACF"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /** A non-empty variable from the run's environment, trimmed, or `undefined`. */
2
+ export declare function envValue(env: Readonly<Record<string, string | undefined>>, name: string): string | undefined;
3
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG5G"}
package/dist/env.js ADDED
@@ -0,0 +1,6 @@
1
+ /** A non-empty variable from the run's environment, trimmed, or `undefined`. */
2
+ export function envValue(env, name) {
3
+ const value = env[name]?.trim();
4
+ return value === undefined || value === '' ? undefined : value;
5
+ }
6
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,GAAiD,EAAE,IAAY;IACtF,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IAChC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACjE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `@e2e-dev/eas` public surface: `easSimulators()`, a device provider that
3
+ * leases hosted simulators from EAS Simulators for `@e2e-dev/mobile`. It
4
+ * talks to Expo's API over `fetch`, so it needs no SDK.
5
+ */
6
+ export { easSimulators } from './provider.ts';
7
+ export type { EasSimulatorsOptions } from './provider.ts';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@e2e-dev/eas` public surface: `easSimulators()`, a device provider that
3
+ * leases hosted simulators from EAS Simulators for `@e2e-dev/mobile`. It
4
+ * talks to Expo's API over `fetch`, so it needs no SDK.
5
+ */
6
+ export { easSimulators } from './provider.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** EAS Simulators' hosted iOS simulators and Android emulators as a `DeviceProvider` for the mobile engine. */
2
+ import type { DeviceProvider } from '@e2e-dev/mobile';
3
+ /** What `easSimulators()` takes: the Expo project, the app each simulator starts with, and the simulator itself. */
4
+ export interface EasSimulatorsOptions {
5
+ /** The Expo project the sessions belong to: its id (`extra.eas.projectId` in the app config), not its slug. */
6
+ readonly projectId: string;
7
+ /**
8
+ * EAS Build EAS installs and launches on every simulator before the session
9
+ * is ready: a simulator build (`ios.simulator: true`) or an APK. Pair it
10
+ * with the target's `app.bundleId` and leave `app.appPath` out.
11
+ */
12
+ readonly buildId?: string | undefined;
13
+ /** URL of an app archive EAS downloads and installs in place of an EAS Build; excludes `buildId`. */
14
+ readonly applicationArchiveUrl?: string | undefined;
15
+ /** Simulator to start: an iOS device name or UDID (`iPhone 17 Pro`), or an Android AVD hardware profile (`pixel_9`). Absent, EAS picks. */
16
+ readonly device?: string | undefined;
17
+ /**
18
+ * Minutes without an agent-device command after which EAS stops the
19
+ * session. Defaults to 10, or one less than `maxDurationMinutes` when that
20
+ * is shorter, since EAS wants it below the duration. A session still
21
+ * queued once another session of the run has been ready for that one's
22
+ * limit fails the lease: EAS is stopping that one.
23
+ */
24
+ readonly maxIdleTimeMinutes?: number | undefined;
25
+ /** Minutes a session may run once ready before EAS stops it. Absent, the account's cap: 40, or 115 on a high-priority plan. */
26
+ readonly maxDurationMinutes?: number | undefined;
27
+ /**
28
+ * The agent-device version EAS starts the session's daemon at. Defaults to
29
+ * the one `@e2e-dev/mobile` pins, so the remote daemon answers as the
30
+ * engine's client expects; EAS otherwise starts the latest.
31
+ */
32
+ readonly agentDeviceVersion?: string | undefined;
33
+ /** Tags on every session, beside the run's own; EAS stores them lowercased. */
34
+ readonly tags?: readonly string[] | undefined;
35
+ }
36
+ /**
37
+ * EAS Simulators for `mobile({ device: easSimulators() })`: one hosted
38
+ * simulator per worker slot, started when the run starts and stopped when it
39
+ * ends, each driven through the agent-device daemon EAS runs beside it.
40
+ * Every session is named after its target and slot and tagged with the run.
41
+ * `EXPO_TOKEN` comes from the run's environment.
42
+ */
43
+ export declare function easSimulators(options: EasSimulatorsOptions): DeviceProvider;
44
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAG/G,OAAO,KAAK,EAAe,cAAc,EAAuC,MAAM,iBAAiB,CAAC;AA6CxG,oHAAoH;AACpH,MAAM,WAAW,oBAAoB;IACnC,+GAA+G;IAC/G,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,qGAAqG;IACrG,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpD,2IAA2I;IAC3I,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,+HAA+H;IAC/H,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CA4E3E"}
@@ -0,0 +1,168 @@
1
+ /** EAS Simulators' hosted iOS simulators and Android emulators as a `DeviceProvider` for the mobile engine. */
2
+ import { setTimeout as sleep } from 'node:timers/promises';
3
+ import { ConfigurationError, rejectUnknownKeys } from 'e2e/engine';
4
+ import { envValue } from './env.js';
5
+ import { easSessions } from './client.js';
6
+ const EXPO_TOKEN = 'EXPO_TOKEN';
7
+ /**
8
+ * EAS stops a session no agent-device command reached for this long: the
9
+ * backstop for a run that died before the engine could release its lease.
10
+ */
11
+ const DEFAULT_MAX_IDLE_TIME_MINUTES = 10;
12
+ /** How often a starting session is polled; a simulator takes about three minutes to queue, boot, and install a build. */
13
+ const POLL_INTERVAL_MS = 5_000;
14
+ /** A session queued this long waits for capacity, not for a machine; every session queues briefly. */
15
+ const QUEUE_NOTICE_MS = 2 * 60_000;
16
+ /** A session that left the queue and is still not ready after this long is stuck booting or installing; eas-cli gives up at the same point. */
17
+ const STARTUP_TIMEOUT_MS = 15 * 60_000;
18
+ /** State polls that may fail in a row, a blip at api.expo.dev, before the session is given up. */
19
+ const POLL_FAILURES_TOLERATED = 3;
20
+ /**
21
+ * When EAS stops each ready session a run holds for idling, by run and
22
+ * session id, across every `easSimulators()` of the run: targets prepare one
23
+ * after another in the runner process, so a target's ready sessions sit idle
24
+ * while the next target's queue.
25
+ */
26
+ const idleDeadlines = new Map();
27
+ /** Every option `easSimulators()` takes, kept equal to `EasSimulatorsOptions` by the compiler. */
28
+ const OPTION_KEYS = Object.keys({
29
+ projectId: true,
30
+ buildId: true,
31
+ applicationArchiveUrl: true,
32
+ device: true,
33
+ maxIdleTimeMinutes: true,
34
+ maxDurationMinutes: true,
35
+ agentDeviceVersion: true,
36
+ tags: true,
37
+ });
38
+ /**
39
+ * EAS Simulators for `mobile({ device: easSimulators() })`: one hosted
40
+ * simulator per worker slot, started when the run starts and stopped when it
41
+ * ends, each driven through the agent-device daemon EAS runs beside it.
42
+ * Every session is named after its target and slot and tagged with the run.
43
+ * `EXPO_TOKEN` comes from the run's environment.
44
+ */
45
+ export function easSimulators(options) {
46
+ rejectUnknownKeys('easSimulators()', options, OPTION_KEYS);
47
+ const { projectId, buildId, applicationArchiveUrl, device, maxDurationMinutes, agentDeviceVersion, tags = [] } = options;
48
+ if (buildId !== undefined && applicationArchiveUrl !== undefined) {
49
+ throw new ConfigurationError('INVALID_CONFIG', 'easSimulators: pass `buildId` or `applicationArchiveUrl`, not both');
50
+ }
51
+ if (options.maxIdleTimeMinutes !== undefined && maxDurationMinutes !== undefined && options.maxIdleTimeMinutes >= maxDurationMinutes) {
52
+ throw new ConfigurationError('INVALID_CONFIG', 'easSimulators: `maxIdleTimeMinutes` must be below `maxDurationMinutes`, as EAS requires');
53
+ }
54
+ const idleMinutes = options.maxIdleTimeMinutes ?? (maxDurationMinutes === undefined ? DEFAULT_MAX_IDLE_TIME_MINUTES : Math.min(DEFAULT_MAX_IDLE_TIME_MINUTES, maxDurationMinutes - 1));
55
+ // EAS takes no idle limit of zero; a session that short runs to its duration.
56
+ const maxIdleTimeMinutes = idleMinutes >= 1 ? idleMinutes : undefined;
57
+ const clients = new Map();
58
+ const clientFor = (env) => {
59
+ const token = envValue(env, EXPO_TOKEN);
60
+ if (token === undefined)
61
+ throw new Error(`${EXPO_TOKEN} is not set`);
62
+ let client = clients.get(token);
63
+ if (client === undefined) {
64
+ client = easSessions(token);
65
+ clients.set(token, client);
66
+ }
67
+ return client;
68
+ };
69
+ return {
70
+ name: 'eas-simulators',
71
+ async acquire(request) {
72
+ if (request.appPath !== undefined && (buildId !== undefined || applicationArchiveUrl !== undefined)) {
73
+ throw new Error("EAS installs the app from `buildId` or `applicationArchiveUrl`; leave the target's `app.appPath` out");
74
+ }
75
+ const client = clientFor(request.env);
76
+ // Not the request's signal: an interrupt that lands after EAS created the session would leave it unknown, and billed.
77
+ const created = await client.create({
78
+ appId: projectId,
79
+ platform: request.platform,
80
+ name: `e2e ${request.targetName} ${request.slot + 1} of ${request.slots}`,
81
+ tags: [...tags, 'e2e', `e2e-run:${request.runId}`, `e2e-target:${request.targetName}`],
82
+ buildId,
83
+ applicationArchiveUrl,
84
+ deviceIdentifier: device,
85
+ maxIdleTimeMinutes,
86
+ maxRunTimeMinutes: maxDurationMinutes,
87
+ packageVersion: agentDeviceVersion ?? request.agentDeviceVersion,
88
+ }, AbortSignal.timeout(60_000));
89
+ request.log(`simulator session ${created.id}, ${created.url}`);
90
+ try {
91
+ const session = await ready(client, created.id, request);
92
+ if (session.openPreviewUrl !== undefined)
93
+ request.log(`watch at ${session.openPreviewUrl}`);
94
+ if (maxIdleTimeMinutes !== undefined) {
95
+ let held = idleDeadlines.get(request.runId);
96
+ if (held === undefined) {
97
+ held = new Map();
98
+ idleDeadlines.set(request.runId, held);
99
+ }
100
+ held.set(created.id, Date.now() + maxIdleTimeMinutes * 60_000);
101
+ }
102
+ return { id: created.id, daemon: { baseUrl: session.daemonUrl, authToken: session.daemonToken } };
103
+ }
104
+ catch (cause) {
105
+ // EAS bills a session from the moment it starts, and the engine holds only leases `acquire` returned.
106
+ const outcome = await client.stop(created.id, AbortSignal.timeout(10_000)).then(() => 'stopped it', (stopCause) => `stopping it failed, so EAS stops it at its idle or duration limit (${stopCause instanceof Error ? stopCause.message : String(stopCause)})`);
107
+ const reason = request.signal.aborted ? 'cancelled' : cause instanceof Error ? cause.message : String(cause);
108
+ throw new Error(`simulator session ${created.id} did not become ready: ${reason}; ${outcome}, ${created.url}`, { cause });
109
+ }
110
+ },
111
+ async release(lease, context) {
112
+ const held = idleDeadlines.get(context.runId);
113
+ held?.delete(lease.id);
114
+ if (held?.size === 0)
115
+ idleDeadlines.delete(context.runId);
116
+ await clientFor(context.env).stop(lease.id, context.signal);
117
+ },
118
+ };
119
+ }
120
+ /**
121
+ * Polls a session until its agent-device daemon is reachable. Says once when
122
+ * it has queued for two minutes, and gives up when it is still queued once
123
+ * another session of the run has idled to its limit, boots for longer than
124
+ * eas-cli waits, ends, or the API fails several polls in a row. The idle
125
+ * clock counts from ready: warm-up commands may reset it at EAS, so the give
126
+ * up can come that much early, never late.
127
+ */
128
+ async function ready(client, id, request) {
129
+ const queuedSince = Date.now();
130
+ let startedAt;
131
+ let noticed = false;
132
+ let failures = 0;
133
+ for (;;) {
134
+ let state;
135
+ try {
136
+ state = await client.state(id, request.signal);
137
+ failures = 0;
138
+ }
139
+ catch (cause) {
140
+ failures += 1;
141
+ if (request.signal.aborted || failures > POLL_FAILURES_TOLERATED)
142
+ throw cause;
143
+ await sleep(POLL_INTERVAL_MS, undefined, { signal: request.signal });
144
+ continue;
145
+ }
146
+ if (state.phase === 'ready')
147
+ return state;
148
+ if (state.phase === 'ended')
149
+ throw new Error(`session ${state.status}`);
150
+ const now = Date.now();
151
+ if (state.phase === 'queued') {
152
+ if (now >= Math.min(...(idleDeadlines.get(request.runId)?.values() ?? []))) {
153
+ throw new Error('still queued while another session of this run idled to its `maxIdleTimeMinutes`, where EAS stops it; lower `workers` or raise `maxIdleTimeMinutes`');
154
+ }
155
+ if (!noticed && now - queuedSince >= QUEUE_NOTICE_MS) {
156
+ noticed = true;
157
+ request.log('still queued at EAS after two minutes; tests start once every worker has a simulator');
158
+ }
159
+ }
160
+ else {
161
+ startedAt ??= now;
162
+ if (now - startedAt >= STARTUP_TIMEOUT_MS)
163
+ throw new Error(`still starting after ${STARTUP_TIMEOUT_MS / 60_000} minutes`);
164
+ }
165
+ await sleep(POLL_INTERVAL_MS, undefined, { signal: request.signal });
166
+ }
167
+ }
168
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAA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EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC3E,MAAM,IAAI,KAAK,CACb,qJAAqJ,CACtJ,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,OAAO,IAAI,GAAG,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;gBACrD,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,sFAAsF,CAAC,CAAC;YACtG,CAAC;QACH,CAAC;aAAM,CAAC;YACN,SAAS,KAAK,GAAG,CAAC;YAClB,IAAI,GAAG,GAAG,SAAS,IAAI,kBAAkB;gBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,kBAAkB,GAAG,MAAM,UAAU,CAAC,CAAC;QAC5H,CAAC;QACD,MAAM,KAAK,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@e2e-dev/eas",
3
+ "version": "0.1.0",
4
+ "description": "EAS Simulators for e2e: run mobile targets on Expo's hosted iOS simulators and Android emulators",
5
+ "keywords": [
6
+ "e2e",
7
+ "testing",
8
+ "agentic",
9
+ "end-to-end",
10
+ "eas",
11
+ "expo",
12
+ "simulators",
13
+ "hosted-devices"
14
+ ],
15
+ "license": "Apache-2.0",
16
+ "contributors": [
17
+ "Oskar Kwaśniewski <oskar@tester.army>",
18
+ "Szymon Rybczak <szymon@tester.army>"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/tester-army/e2e.git",
23
+ "directory": "packages/eas"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/tester-army/e2e/issues"
27
+ },
28
+ "homepage": "https://github.com/tester-army/e2e/tree/main/packages/eas#readme",
29
+ "publishConfig": {
30
+ "registry": "https://registry.npmjs.org/",
31
+ "access": "public",
32
+ "provenance": false,
33
+ "tag": "latest"
34
+ },
35
+ "type": "module",
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "NOTICE"
45
+ ],
46
+ "peerDependencies": {
47
+ "@e2e-dev/mobile": ">=0.8.0 <1",
48
+ "e2e": ">=0.15.0 <1"
49
+ },
50
+ "devDependencies": {
51
+ "@e2e-dev/mobile": "0.8.0",
52
+ "@types/node": "26.6.2",
53
+ "e2e": "0.15.0",
54
+ "typescript": "7.0.2",
55
+ "vitest": "5.0.1"
56
+ },
57
+ "engines": {
58
+ "node": ">=22.12.0"
59
+ },
60
+ "scripts": {
61
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && node ../../scripts/stamp-dist.ts",
62
+ "typecheck": "tsc --noEmit",
63
+ "test": "vitest run",
64
+ "test:watch": "vitest",
65
+ "test:unit": "vitest run tests/unit"
66
+ }
67
+ }