Skip to content

[CLEANUP] Render tests through a Glimmer root component - #21775

Merged
ef4 merged 3 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/glimmer-test-harness-root
Nov 3, 2026
Merged

ef4 merged 3 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/glimmer-test-harness-root

Conversation

@NullVoxPopuli-ai-agent

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Test templates now render through a Glimmer component, not a classic Component. This lets #21630 deprecate the class with no exception for the test harness.

What changes

  • RenderingTestCase and RouterNonApplicationTestCase render through TopLevelComponent, a new @glimmer/component class in internal-test-helpers.
  • That class keeps get, set and rerender, so about 180 this.context.set(...) calls stay the same.
  • The root uses the default dynamic scope of renderComponent, the same as an application. There are no production changes.

Test changes

  • ClassicRenderingTestCase in tests/utils renders through the classic top-level component, as the harness did before.
  • Ember's DynamicScope exists only below a classic root from appendTo. Tests that read it use ClassicRenderingTestCase, with their original assertions:
    • Five files in components/classic/: angle bracket, curly, dynamic, life-cycle, and error handling. They assert on parentView and childViews.
    • classic/yield-test.js, which reads parentView.
    • The two {{-with-dynamic-var}} tests that expect the assertion for a key other than outletState.
  • The stack label for a Glimmer root is {ROOT}, the same as the root outlet.
  • The template cache counters below a Glimmer root changed. templateCacheHits: 0 stays in the test.
  • Three <Input> tests use an arrow function, because action() in the context needs a classic class.
  • In production, a retry after an initial render error creates a new Glimmer root. That error handling test keeps its state outside the root.

New classic tests

8 new tests in components/classic/ keep the coverage that the Glimmer root no longer reaches:

  • Recovery after an error in the initial render, below a classic root.
  • The -top-level label in a backtracking message.
  • The template cache counters and hits, in 3 tests.
  • action() in the context of a classic root, in 3 <Input> tests.

Coverage that is gone

  • The other classic tests no longer render through a classic root. append-test.js and the five files above still use that path.
  • The setProperties and incrementProperty calls on the root in three tests. The root was not the subject of those tests.

Verified locally

All 9 CI variants pass. The default run has 9269 tests, which is main plus the 8 new classic tests. pnpm lint, all type-check scripts, pnpm build, and pnpm lint:docs pass.

🤖 Generated with Claude Code

`RenderingTestCase` and `RouterNonApplicationTestCase` used a classic
`Component` as the `this` of each test template. The class is going to
be deleted, and the harness must not depend on it.

The root is now a Glimmer component. It keeps `get`, `set` and
`rerender`, so tests that change the context stay the same.

The render option `dynamicScope` is private. The default scope of a
component root does not pass `view` to its children, so nested classic
components lose `parentView` without it.

Tests that read the classic root now do one of these:

- Life-cycle tests render below a real classic parent.
- Other tests assert the relation between their own components.
- The stack label for a root is `{ROOT}`, as for the root outlet.
- Cache counters no longer count the classic root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
state: RendererState,
definition: object,
options: { into: Cursor; args?: Record<string, unknown> }
options: { into: Cursor; args?: Record<string, unknown>; dynamicScope?: DynamicScope }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least this isn't renderComponent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good change

NullVoxPopuli and others added 2 commits October 31, 2026 12:16
`ClassicRenderingTestCase` renders through the classic top-level
component, as the harness did before. The classic tests that read that
root use it again, with their original assertions.

New tests in `components/classic/` cover what the rest of the suite no
longer reaches:

- Recovery after an error in the initial render.
- The `-top-level` label in a backtracking message.
- The template cache counters below a classic root.
- `action()` in the context of a classic root.

`templateCacheHits: 0` stays in the runtime resolver cache test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Glimmer root of the test harness now uses the default dynamic
scope of renderComponent, like an application does. The private
dynamicScope option of BaseRenderer.render is gone.

Ember's DynamicScope exists only below a classic root from appendTo.
Three tests read it, so they render through ClassicRenderingTestCase:

- yield should not introduce a view, which reads parentView
- the two -with-dynamic-var tests that expect the assertion
  for a key other than outletState

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ef4
ef4 merged commit 493985e into emberjs:main Nov 3, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants