Conversation
… creact/testing The counter logged "Count: 0" twice at startup: the effect ran once on the undefined initial output (shown as 0 via ?? 0) and again when the async handler set count to 0. Wait for the first real value before logging, so it prints 0 once, then 1, 2, ... Also pin the scaffolded deps to "latest" so a fresh app always gets the newest @creact-labs/creact and @creact-labs/testing instead of an aging caret range. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the author fields and the LICENSE copyright line with the project org (CReact Labs) so no personal name or email address remains in the codebase. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…testId Previously `useAsyncOutput` forced a `key` on every component (and the root's key was overwritten with the stack name), conflating React's reconciliation key with the durable-state address. Now: - A lone component addresses by its name (name-name); a `key` is required only to disambiguate colliding siblings (the existing collision check enforces that). - `key` is once again just the React key; the root is no longer stamped with the stack name (injectRootKey removed). - InstanceNode carries `key`, `type`, and `testId` (read off the element props), so tools can query nodes by any of them. `testId` is a universal JSX attribute. - Widen JSX.Element / CReactNode to what the runtime actually accepts (arrays, text, booleans, accessors) — Solid-style — so components may return fragments. BREAKING: node ids for previously-keyed roots change; components no longer need a key when unambiguous. Bumped to 0.5.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rework @creact-labs/testing around RTL's philosophy — you observe deployed nodes, their outputs, and testId/key/type instead of DOM: - `render(ui, options?)` returns a view with getBy/queryBy/findBy queries by testId, key, and type (get throws on 0 or >1, query returns null, find waits), plus `nodes()`, `waitFor`, and ergonomic node handles with `output()`/`outputs()`. - `waitFor(callback)` retries a callback until it returns truthy (RTL-style). - Remove the nonsensical public `h` element factory and the low-level findNode/queryNodes/readOutput/renderTest surface; app authors write real JSX. - peerDependency and tests track creact ^0.5.0. BREAKING API change. Bumped to 0.2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With `h` gone from @creact-labs/testing, the runtime's own tests use real JSX (component elements) and plain object literals (raw string/Symbol element types the pipeline tests build by hand). Components that read `props.key` as a useAsyncOutput dependency — an artifact of the old h (which wrongly left key in props) — now use real deps; identity comes from the element key. Coverage stays at 100%. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The generated index.test.tsx now teaches @creact-labs/testing's real API: render() + getByTestId (with getByType/getByKey noted) + output(), no h. The app renders a lone <Counter /> (no key needed) with a testId for querying. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- waitFor now awaits its callback, so an async predicate retries on its resolved value instead of returning immediately on the always-truthy pending promise; covered with an async test. TestView.waitFor accepts async callbacks too. - the default-backend test spies NoopMemory.saveState to actually verify render's default (was tautological — the local memory was never passed to render). - scaffold: fix the index.test.tsx comment and reword the README (the counter does start a real timer; the test just doesn't wait on it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix: counter double-0 + always-latest scaffold; RTL-style @creact-labs/testing; decouple key from identity; drop h
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR introduces a runtime-backed testing render/query API, polling-based ChangesTesting and runtime update
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant TestingRender
participant CoreRuntime
participant TestView
Test->>TestingRender: render(ui, options)
TestingRender->>CoreRuntime: start render with memory and id
CoreRuntime-->>TestingRender: lifecycle promises and instance nodes
TestingRender-->>TestView: expose selectors and output accessors
Test->>TestView: query or wait for a node
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🤖 Grok fallow review — proceedZero-finding bar met across dead code, duplication, health thresholds, and audit; release may proceed.
Reviews the full fallow report — dead code, duplication, health, and audit. Re-runs edit this comment. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/testing/src/wait-for.ts`:
- Around line 20-40: Update waitFor so each callback attempt is raced against
the configured timeout deadline rather than awaiting callback() indefinitely.
Ensure a slow or never-resolving callback causes waitFor to throw once timeout
elapses, while preserving retries, lastError handling, and immediate success for
truthy callback results.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 39b11da9-ee30-4f73-8a68-dfbbe18a444d
📒 Files selected for processing (31)
LICENSEpackage.jsonpackages/creact/package.jsonpackages/creact/src/flow/__tests__/error-boundary.test.tsxpackages/creact/src/flow/__tests__/for.test.tsxpackages/creact/src/flow/__tests__/show.test.tsxpackages/creact/src/flow/__tests__/switch.test.tsxpackages/creact/src/jsx/jsx-runtime.tspackages/creact/src/runtime/__tests__/create-runtime.test.tsxpackages/creact/src/runtime/__tests__/instance.test.tsxpackages/creact/src/runtime/__tests__/render.test.tsxpackages/creact/src/runtime/__tests__/run.test.tsxpackages/creact/src/runtime/instance.tspackages/creact/src/runtime/run.tspackages/creact/src/store/__tests__/store.test.tsxpackages/creact/tsconfig.test.jsonpackages/create-creact-app/package.jsonpackages/create-creact-app/src/__tests__/templates.test.tspackages/create-creact-app/src/templates.tspackages/testing/package.jsonpackages/testing/src/__tests__/memory.test.tspackages/testing/src/__tests__/query.test.tspackages/testing/src/__tests__/render-test.test.tspackages/testing/src/__tests__/render.test.tsxpackages/testing/src/__tests__/wait-for.test.tspackages/testing/src/index.tspackages/testing/src/jsx.tspackages/testing/src/query.tspackages/testing/src/render-test.tspackages/testing/src/render.tspackages/testing/src/wait-for.ts
💤 Files with no reviewable changes (6)
- packages/testing/src/jsx.ts
- packages/testing/src/render-test.ts
- packages/testing/src/tests/query.test.ts
- packages/testing/src/tests/render-test.test.ts
- packages/creact/src/runtime/run.ts
- packages/testing/src/query.ts
Each iteration awaited callback() before checking the clock, so a callback that never settles blocked the loop forever regardless of the timeout. Race each callback against the deadline (beforeDeadline) so waitFor always gives up near its timeout. Covered with a hanging-callback test and an async-rejection test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The retry slept a full interval before re-checking the clock, so a large interval
(e.g. { timeout: 20, interval: 10_000 }) rejected long after the timeout. Sleep
only up to the deadline (min(interval, remaining)) and throw once it's reached.
Covered with an interval-larger-than-timeout test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix(testing): bound waitFor by its timeout when a callback hangs
Releases PR #17 — the counter fix, the RTL-style testing library, the
key/hcleanup, and always-latest scaffolding. Merging pushesdevelop → releaseand triggers the Release workflow, which reconciles each package independently.What this release publishes
@creact-labs/creactnode.key/type/testId; wider JSX types@creact-labs/testingrender+ queries (testId/key/type);hremovedcreate-creact-appCount: 0, always-latest deps, testing-API showcase testEach publishes to npm + gets a
<name>@<version>tag and GitHub Release; already-released artifacts are skipped (idempotent).Breaking notes
.statefiles won't map — resources re-deploy. A loneuseAsyncOutputcomponent no longer needs akey.h,renderTest, and the low-levelfindNode/readOutputare gone; peer dependency is now@creact-labs/creact ^0.5.0. Userender()+getByTestId/getByType/getByKey.Verified
creact 656 tests / 100% coverage; testing 22; create-creact-app 26; all fallow gates + the shared publish gate (isolated build + publint + attw) green; end-to-end scaffold → install
0.5.0/0.2.0→npm testpasses → app runs with a singleCount: 0.Summary by CodeRabbit
New Features
render()testing API with node queries (by type/key/testId) and output accessors.waitFor()polling with configurabletimeoutandinterval.testIdsupport for rendered nodes and improved ability to address components without requiring a key.Breaking Changes
h,renderTest, and lower-level query/read utilities).waitForto use callback polling instead of accessor-based waiting.Releases