e2e: consume the testkit from dist/, like anyone else would
commit 39823989c86e8d1295b7ed9cf7090dc0b419241c · parent 8aeaa903f0
· browse this tree
Ximianth, 2026-10-11 23:24:47 UTC
The testkit's published exports map carried a "yukey-source" condition pointing at src/*.ts, files that aren't in the tarball. It existed so the e2e package could skip building the testkit. That's a workspace convenience leaking into the published manifest; the testkit is three files and builds in a second, so e2e's check and test:e2e scripts build it first instead, and resolve it the ordinary way.
diff --git a/docs/hacking/README.md b/docs/hacking/README.md index 32fd096..a9b1db8 100644 --- a/docs/hacking/README.md +++ b/docs/hacking/README.md @@ -39,10 +39,7 @@ Things worth knowing - The published packages ship `dist/` (`.js` + `.d.ts` + maps), not `.ts`. Lit's decorators require `experimentalDecorators` and `useDefineForClassFields: false`; compiling here means consumers don't have to match those flags. Consequence: anything consuming yukey via a `file:` dependency must `make build` here first. -- `packages/e2e` imports `yukey-testkit` through the workspace symlink. - The testkit's `exports` map carries a `yukey-source` condition pointing at `src/*.ts`; - the e2e package's tsconfig (`customConditions`) and its node invocation (`--conditions=yukey-source`) both select it, - so typechecking and running the suite never require a testkit build. - The default condition still resolves to `dist/`, which is what every outside consumer gets. +- `packages/e2e` imports `yukey-testkit` through the workspace symlink and resolves to its `dist/`, like any outside consumer would. + The e2e package's `check` and `test:e2e` scripts build the testkit first, so this never needs remembering. - The e2e suite needs a Chromium. It defaults to `/headless-shell/headless-shell`; `YUKEY_E2E_CHROME` overrides. Chrome is launched with `--no-sandbox` (fine for headless-shell in a container; worth knowing if you point it at a desktop Chrome). diff --git a/packages/e2e/package.json b/packages/e2e/package.json index ce82995..cd6a712 100644 --- a/packages/e2e/package.json +++ b/packages/e2e/package.json @@ -4,8 +4,8 @@ "description": "yukey's own end-to-end suite: serves the gallery bundle, launches a headless Chrome, drives the gallery entries with trusted input", "type": "module", "scripts": { - "check": "tsc --noEmit", - "test:e2e": "node --conditions=yukey-source main.ts" + "check": "npm run build --workspace yukey-testkit && tsc --noEmit", + "test:e2e": "npm run build --workspace yukey-testkit && node main.ts" }, "dependencies": { "yukey-testkit": "*" diff --git a/packages/e2e/tsconfig.json b/packages/e2e/tsconfig.json index 45f5612..6df2cfe 100644 --- a/packages/e2e/tsconfig.json +++ b/packages/e2e/tsconfig.json @@ -12,10 +12,7 @@ "strict": true, "noUncheckedIndexedAccess": true, "allowImportingTsExtensions": true, - "noEmit": true, - "customConditions": [ - "yukey-source" - ] + "noEmit": true }, "include": [ "." diff --git a/packages/yukey-testkit/package.json b/packages/yukey-testkit/package.json index 1795f15..043d1f4 100644 --- a/packages/yukey-testkit/package.json +++ b/packages/yukey-testkit/package.json @@ -6,17 +6,14 @@ "type": "module", "exports": { "./cdp": { - "yukey-source": "./src/cdp.ts", "types": "./dist/cdp.d.ts", "default": "./dist/cdp.js" }, "./checks": { - "yukey-source": "./src/checks.ts", "types": "./dist/checks.d.ts", "default": "./dist/checks.js" }, "./sleep": { - "yukey-source": "./src/sleep.ts", "types": "./dist/sleep.d.ts", "default": "./dist/sleep.js" }