@e2e-dev/limrun 0.2.4-nightly-20261105030216 → 0.2.4

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/README.md CHANGED
@@ -13,6 +13,6 @@ const engine = mobile({ platform: 'ios', device: limrun() });
13
13
  Set `LIMRUN_API_KEY` in the run environment and install `@limrun/api`.
14
14
  Android also requires `adb` on `PATH` for the driver's tunnel.
15
15
 
16
- See the [integration guide](https://e2e.tester.army/docs/integrations/limrun)
16
+ See the [integration guide](https://e2e.com/docs/integrations/limrun)
17
17
  and Limrun's [app-flow example](https://github.com/limrun-inc/testerarmy-e2e-limrun) for setup and tests
18
18
  that run unchanged on both platforms.
package/dist/.build.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.2.4-nightly-20261105030216"}
1
+ {"version":"0.2.4"}
package/dist/provider.js CHANGED
@@ -2,16 +2,17 @@ import { mkdtemp, rm } from 'node:fs/promises';
2
2
  import { tmpdir } from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { setTimeout as sleep } from 'node:timers/promises';
5
- import Limrun from '@limrun/api';
6
5
  import { ConfigurationError, rejectUnknownKeys } from 'e2e/engine';
7
6
  import { startHeartbeat } from './heartbeat.js';
8
7
  import { assertAndroidTools, assertDriverVersion, startDriver, stopDriver } from './daemon.js';
9
- function api(env) {
8
+ /** A client for the run's API key. The SDK loads here, with the first device a worker leases, not with the config. */
9
+ async function api(env) {
10
10
  const apiKey = env.LIMRUN_API_KEY?.trim();
11
11
  if (!apiKey)
12
12
  throw new ConfigurationError('INVALID_CONFIG', '@e2e-dev/limrun requires LIMRUN_API_KEY in the run environment');
13
+ const { default: Sdk } = await import('@limrun/api');
13
14
  // Retrying a create after an ambiguous response could allocate a second device.
14
- return new Limrun({ apiKey, baseURL: env.LIMRUN_BASE_URL?.trim() || 'https://api.limrun.com', maxRetries: 0, timeout: 60_000, defaultHeaders: { 'X-Limrun-Client': 'e2e' } });
15
+ return { client: new Sdk({ apiKey, baseURL: env.LIMRUN_BASE_URL?.trim() || 'https://api.limrun.com', maxRetries: 0, timeout: 60_000, defaultHeaders: { 'X-Limrun-Client': 'e2e' } }), NotFoundError: Sdk.NotFoundError };
15
16
  }
16
17
  function access(instance) {
17
18
  const { apiUrl, token } = instance.status;
@@ -19,7 +20,7 @@ function access(instance) {
19
20
  throw new Error(`Limrun instance ${instance.metadata.id} has no control endpoint or token. Use an API key with full control.`);
20
21
  return { apiUrl, token };
21
22
  }
22
- async function ready(client, platform, instance, signal) {
23
+ async function ready({ client, NotFoundError }, platform, instance, signal) {
23
24
  let current = instance;
24
25
  while (true) {
25
26
  signal.throwIfAborted();
@@ -33,18 +34,18 @@ async function ready(client, platform, instance, signal) {
33
34
  }
34
35
  catch (cause) {
35
36
  // The regional create can precede the backend read model. The caller's budget bounds readiness.
36
- if (!(cause instanceof Limrun.NotFoundError))
37
+ if (!(cause instanceof NotFoundError))
37
38
  throw cause;
38
39
  }
39
40
  }
40
41
  }
41
- async function deleteInstance(client, platform, id, signal) {
42
+ async function deleteInstance({ client, NotFoundError }, platform, id, signal) {
42
43
  try {
43
44
  await (platform === 'ios' ? client.iosInstances : client.androidInstances).delete(id, { signal });
44
45
  }
45
46
  catch (cause) {
46
47
  // An expired or already deleted instance needs no further cleanup.
47
- if (!(cause instanceof Limrun.NotFoundError))
48
+ if (!(cause instanceof NotFoundError))
48
49
  throw cause;
49
50
  }
50
51
  }
@@ -83,7 +84,7 @@ export function limrun(options = {}) {
83
84
  await resource.stopHeartbeat?.();
84
85
  const results = await Promise.allSettled([
85
86
  stopDriver(resource.stateDir, resource.env, signal).then(() => rm(resource.stateDir, { recursive: true, force: true })),
86
- deleteInstance(resource.client, resource.platform, id, signal),
87
+ deleteInstance(resource.api, resource.platform, id, signal),
87
88
  ]);
88
89
  const errors = results.flatMap((result) => result.status === 'rejected' ? [result.reason] : []);
89
90
  if (errors.length)
@@ -95,7 +96,10 @@ export function limrun(options = {}) {
95
96
  async acquire(request) {
96
97
  assertDriverVersion(request.agentDeviceVersion);
97
98
  request.signal.throwIfAborted();
98
- const client = api(request.env);
99
+ const sdk = await api(request.env);
100
+ // The import is the first await, so an interrupt during it must not go on to create a device.
101
+ request.signal.throwIfAborted();
102
+ const { client } = sdk;
99
103
  if (request.platform === 'android')
100
104
  await assertAndroidTools({ ...request.env }, request.signal);
101
105
  const spec = { hardTimeout: options.hardTimeout ?? '1h', ...(options.region === undefined ? {} : { region: options.region }) };
@@ -108,11 +112,11 @@ export function limrun(options = {}) {
108
112
  let resource;
109
113
  try {
110
114
  const stateDir = await mkdtemp(path.join(tmpdir(), 'e2e-limrun-'));
111
- resource = { stateDir, env: { ...request.env }, client, platform: request.platform };
115
+ resource = { stateDir, env: { ...request.env }, api: sdk, platform: request.platform };
112
116
  held.set(id, resource);
113
117
  request.log(`created ${id}`);
114
118
  const signal = AbortSignal.any([request.signal, AbortSignal.timeout(300_000)]);
115
- const instance = await ready(client, request.platform, created, signal);
119
+ const instance = await ready(sdk, request.platform, created, signal);
116
120
  resource.env = driverEnv(request.env, instance, request.platform);
117
121
  const binding = await startDriver({ stateDir, runId: request.runId, slot: request.slot, platform: request.platform, app: request.app, appPath: request.appPath }, resource.env, signal);
118
122
  resource.stopHeartbeat = await startHeartbeat(binding, request.log);
@@ -124,7 +128,7 @@ export function limrun(options = {}) {
124
128
  if (resource)
125
129
  await release(id, resource, signal);
126
130
  else
127
- await deleteInstance(client, request.platform, id, signal);
131
+ await deleteInstance(sdk, request.platform, id, signal);
128
132
  }
129
133
  catch (cleanup) {
130
134
  throw new AggregateError([cause, cleanup], `Limrun acquisition failed; cleanup also failed for ${id}`, { cause: cleanup });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2e-dev/limrun",
3
- "version": "0.2.4-nightly-20261105030216",
3
+ "version": "0.2.4",
4
4
  "description": "Limrun hosted iOS simulators and Android emulators for e2e mobile tests",
5
5
  "keywords": [
6
6
  "e2e",
@@ -40,15 +40,15 @@
40
40
  "NOTICE"
41
41
  ],
42
42
  "peerDependencies": {
43
- "@e2e-dev/mobile": "0.12.6-nightly-20261105030216",
43
+ "@e2e-dev/mobile": ">=0.11.1 <1",
44
44
  "@limrun/api": ">=0.59.0 <1",
45
- "e2e": "0.22.1-nightly-20261105030216"
45
+ "e2e": ">=0.15.0 <1"
46
46
  },
47
47
  "devDependencies": {
48
- "@e2e-dev/mobile": "0.12.6-nightly-20261105030216",
49
- "@limrun/api": "0.69.0",
48
+ "@e2e-dev/mobile": "0.12.6",
49
+ "@limrun/api": "0.69.1",
50
50
  "@types/node": "26.6.6",
51
- "e2e": "0.22.1-nightly-20261105030216",
51
+ "e2e": "0.23.0",
52
52
  "typescript": "7.0.2",
53
53
  "vitest": "5.1.0"
54
54
  },