@roku-sdk/device-test-client 2.18.0 → 2.19.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/BREAKING_CHANGES.md +17 -0
- package/docs/errors.md +25 -6
- package/docs/log-assertions.md +35 -0
- package/docs/rkclient.md +3 -1
- package/package.json +16 -15
- package/src/client/build-cache.ts +4 -4
- package/src/client/client.ts +346 -38
- package/src/client/deploy.ts +7 -2
- package/src/client/factory.ts +25 -2
- package/src/client/health.ts +131 -0
- package/src/client/parsers.ts +10 -3
- package/src/constants.ts +49 -0
- package/src/errors.ts +2 -1
- package/src/index.ts +18 -23
- package/src/jest/global-setup.ts +4 -0
- package/src/jest/install-hooks.ts +3 -1
- package/src/logs/log-buffer.ts +17 -4
- package/src/logs/log-session.ts +62 -0
- package/src/types.ts +29 -0
- package/support/constants.ts +17 -0
- package/support/deploy.ts +27 -0
- package/support/paths.ts +13 -0
- package/internal/constants.ts +0 -54
- package/internal/deploy.ts +0 -60
- package/internal/paths.ts +0 -15
package/support/paths.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@roku-sdk/device-test-client/support/paths`: where a test run writes its artifacts.
|
|
6
|
+
*
|
|
7
|
+
* Multi-device runners and Jest global setup use these to agree on the `test-results/`
|
|
8
|
+
* directory. Like `./support/constants`, this entry point imports only Node built-ins, so a
|
|
9
|
+
* CommonJS-mode config loader can import it at parse time. It must stay free of `RkClient` and
|
|
10
|
+
* `@roku-sdk/tooling`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { TEST_RESULTS_DIR_ENV_VAR, TEST_RESULTS_DIR_NAME, defaultTestResultsDir } from "../src/paths";
|
package/internal/constants.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `@roku-sdk/device-test-client/internal/constants` — config-load-safe
|
|
6
|
-
* entry point for the small subset of `src/constants.ts` symbols that
|
|
7
|
-
* Jest configs (and other CommonJS-mode loaders) legitimately need at
|
|
8
|
-
* **parse time**.
|
|
9
|
-
*
|
|
10
|
-
* Why this exists, and why the public barrel is not enough:
|
|
11
|
-
*
|
|
12
|
-
* `src/index.ts` re-exports `RkClient` from `src/client/client.ts`,
|
|
13
|
-
* which imports `@roku-sdk/tooling/src/device-test-helpers.ts`. The
|
|
14
|
-
* `@roku-sdk/tooling` package declares `"type": "module"` and uses
|
|
15
|
-
* `import.meta.url`. Loaders that parse `*.config.ts` in CommonJS
|
|
16
|
-
* mode (ts-node default, esbuild-register, the loader Jest invokes
|
|
17
|
-
* from `jest-config/readConfigFileAndSetRootDir`) blow up on the
|
|
18
|
-
* first hop with `ERR_REQUIRE_ESM` — *before* any test, hook, or
|
|
19
|
-
* transform runs. The stack trace points at the loader, not at the
|
|
20
|
-
* import that pulled the ESM file in, so the failure is opaque to
|
|
21
|
-
* the reader of `jest.config.ts`.
|
|
22
|
-
*
|
|
23
|
-
* `src/constants.ts` itself has only `type` imports (all erased by
|
|
24
|
-
* TypeScript) and value-level constants, so a file that imports
|
|
25
|
-
* exclusively from it is parse-safe under CJS. This subpath is the
|
|
26
|
-
* one sanctioned "deep import past the barrel" surface for that
|
|
27
|
-
* purpose.
|
|
28
|
-
*
|
|
29
|
-
* Why a re-export shim instead of a direct entry in `exports`:
|
|
30
|
-
* `device-tests/tsconfig.json` uses `moduleResolution: "Node"`
|
|
31
|
-
* (classic), which falls back to a filesystem walk and does NOT honor
|
|
32
|
-
* the package `exports` map. A physical file at this path resolves
|
|
33
|
-
* under every resolution mode; the `exports` map entry covers the
|
|
34
|
-
* publish-time / `Node16` / `Bundler` case symmetrically. The same
|
|
35
|
-
* pattern is used by `./internal/deploy`.
|
|
36
|
-
*
|
|
37
|
-
* SemVer / stability contract:
|
|
38
|
-
* Symbols here are reachable, typed, and stable across patch releases
|
|
39
|
-
* — but explicitly NOT covered by SemVer (`/internal/` in the path is
|
|
40
|
-
* the tell). Partner code MUST NOT import from this subpath; the
|
|
41
|
-
* public, SemVer-covered surface for these constants stays
|
|
42
|
-
* `@roku-sdk/device-test-client` (curated barrel in `src/index.ts`).
|
|
43
|
-
*
|
|
44
|
-
* Adding new symbols:
|
|
45
|
-
* Only constants that a config-loader truly needs at parse time
|
|
46
|
-
* belong here (file-name constants, env-var names, default budgets
|
|
47
|
-
* referenced by `jest.config.ts` reporters / global setup). Pure-
|
|
48
|
-
* implementation magic numbers stay file-internal in
|
|
49
|
-
* `src/constants.ts`. Prefer extending this barrel over minting a
|
|
50
|
-
* parallel `/internal/<other>` subpath — keeps the internal contract
|
|
51
|
-
* grep-able.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
export { ARTIFACT_FILE } from "../src/constants";
|
package/internal/deploy.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `@roku-sdk/device-test-client/internal/deploy` — explicit internal
|
|
6
|
-
* subpath for the **deploy-side** tooling helpers that the curated
|
|
7
|
-
* public API intentionally does NOT carry.
|
|
8
|
-
*
|
|
9
|
-
* Currently exposes:
|
|
10
|
-
*
|
|
11
|
-
* - `resolveAppPath` — integration-test deploy-guard directory-wipe
|
|
12
|
-
* path resolution.
|
|
13
|
-
* - `invalidateBuildCacheForApp` — release the in-process
|
|
14
|
-
* `RkClient.buildAndDeploy` build memoisation entries scoped to
|
|
15
|
-
* a single `absRoot`. Pairs with the deploy-guard's
|
|
16
|
-
* `wipeIntegrationBuildOutput` so a "we rebuilt because the
|
|
17
|
-
* previous bundle was dirty" recovery path also invalidates the
|
|
18
|
-
* "we already built this" memoisation. Both calls must run in
|
|
19
|
-
* lockstep; calling one without the other is a bug.
|
|
20
|
-
*
|
|
21
|
-
* Symbols here are reachable, typed, and stable across patch
|
|
22
|
-
* releases — but explicitly NOT covered by SemVer (`/internal/` in
|
|
23
|
-
* the path is the tell). Partner code MUST NOT import from this
|
|
24
|
-
* subpath; downstream consumers should treat it as private.
|
|
25
|
-
*
|
|
26
|
-
* Why a re-export shim instead of a direct entry in `exports`:
|
|
27
|
-
* `device-tests/tsconfig.json` uses `moduleResolution: "Node"`
|
|
28
|
-
* (classic), which falls back to a filesystem walk and does NOT honor
|
|
29
|
-
* the package `exports` map. A physical file at this path resolves
|
|
30
|
-
* under every resolution mode; the `exports` map entry covers the
|
|
31
|
-
* publish-time / `Node16` / `Bundler` case symmetrically.
|
|
32
|
-
*
|
|
33
|
-
* Adding new symbols (load-chain caveat):
|
|
34
|
-
* This barrel re-exports from `../src/client/deploy`, which imports
|
|
35
|
-
* `@roku-sdk/tooling/src/device-test-helpers` — an ESM module
|
|
36
|
-
* (`"type": "module"`, `import.meta.url`). Anything importing this
|
|
37
|
-
* subpath therefore pulls that ESM chain in transitively. That is
|
|
38
|
-
* FINE for runtime callers (Jest transforms `@roku-sdk/*` via babel,
|
|
39
|
-
* see `device-tests/jest.config.ts → transform`) but it is FATAL
|
|
40
|
-
* for parse-time loaders such as ts-node in CJS mode that the IDE
|
|
41
|
-
* and Jest itself use to read `*.config.ts`; those crash with
|
|
42
|
-
* `ERR_REQUIRE_ESM` before any transform runs.
|
|
43
|
-
*
|
|
44
|
-
* Group new `@internal` symbols by **load-time safety**, not just
|
|
45
|
-
* by concern:
|
|
46
|
-
* - Runtime-only helpers (need the live client / build pipeline /
|
|
47
|
-
* tooling shim) → add here.
|
|
48
|
-
* - Symbols a `*.config.ts` legitimately reads at parse time →
|
|
49
|
-
* add to `./internal/constants` (or another sibling subpath
|
|
50
|
-
* whose source file imports only types and value-level
|
|
51
|
-
* literals). Re-confirm by tracing the new file's imports to
|
|
52
|
-
* leaves; one accidental hop into `@roku-sdk/tooling` re-breaks
|
|
53
|
-
* the config-loader path.
|
|
54
|
-
*
|
|
55
|
-
* Prefer extending an existing `/internal/<name>` subpath over
|
|
56
|
-
* minting a parallel one — keeps the internal contract grep-able.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
export { resolveAppPath } from "../src/client/deploy";
|
|
60
|
-
export { invalidateBuildCacheForApp } from "../src/client/build-cache";
|
package/internal/paths.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `@roku-sdk/device-test-client/internal/paths` — explicit internal
|
|
6
|
-
* subpath for load-safe path constants/helpers used by test config and
|
|
7
|
-
* setup code.
|
|
8
|
-
*
|
|
9
|
-
* This subpath intentionally re-exports only from `src/paths.ts`, whose
|
|
10
|
-
* runtime imports are Node built-ins. It is safe for CommonJS-mode config
|
|
11
|
-
* loaders (`jest.config.ts`, ts-node) and must stay free of `RkClient`,
|
|
12
|
-
* `@roku-sdk/tooling`, or other ESM-heavy runtime chains.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export { TEST_RESULTS_DIR_ENV_VAR, TEST_RESULTS_DIR_NAME, defaultTestResultsDir } from "../src/paths";
|