Use settled from @ember/test-helpers in the RouterService transitionTo tests - #21658
Open
NullVoxPopuli-ai-agent wants to merge 1 commit into
Open
NullVoxPopuli-ai-agent wants to merge 1 commit into
NullVoxPopuli-ai-agent wants to merge 1 commit into
Conversation
Four RouterService#transitionTo tests started a transition inside `run(() => ...)`. They now start the transition directly and wait with `await settled()`, as an application test does. `@ember/test-helpers` was not available in the main test build. This commit adds it: - `@ember/test-helpers` is a devDependency of the root package. - `testDependencies` in rollup.config.mjs lets the test build resolve `@ember/test-helpers`, `@ember/test-waiters` and `dom-element-descriptors` from node_modules. - babel.test.config.mjs runs the `@embroider/macros` plugin, because those two addons use macros. `buildMacros()` reads NODE_ENV, but the test build selects its mode with EMBER_ENV. The `configure` hook enables development mode from EMBER_ENV, so `isDevelopingApp()` is the same with and without NODE_ENV. The published build does not use babel.test.config.mjs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
import { settled } from '@ember/test-helpers'now works in the main test suite.transitionTo_test.jsis the first file that uses it.Before,
@ember/test-helperswas only available in the smoke tests.The test file
packages/ember/tests/routing/router_service_test/transitionTo_test.jshad four tests that started a transition insiderun(() => ...). They are a good fit forsettled(), because the wait is for a route transition and not only for a render.No test was added, removed or renamed.
The wiring
package.json@ember/test-helpers^5.5.0as a devDependency. This is the version that the smoke tests use, so the lockfile gets three lines.rollup.config.mjstestDependenciesgets@ember/test-helpers,@ember/test-waitersanddom-element-descriptors.babel.test.config.mjs@embroider/macrosbabel plugin, because the two addons use macros.buildMacros()readsNODE_ENV, but the test build selects its mode withEMBER_ENV. Theconfigurehook enables development mode fromEMBER_ENV. Without it, a localvite build --mode developmentcompiled@ember/test-waitersin production mode.The published build does not use
babel.test.config.mjs.Limits
ember-source, and it does not depend on itself. As a result,appEmberSatisfies(...)anddependencySatisfies('ember-source', ...)are false inside@ember/test-helpers.settled()is not affected.render()from@ember/test-helpersis not tested here.setupContext.settled()waits for the runloop, timers, test waiters and pending renders. Its router transition flag is not active.Verification
Router Service - transitionTomodule: 19 pass in development, production, both "all deprecations enabled" variants, both "deprecations as errors" variants, and production with optional features.NODE_ENV=development, as CI): 9513 tests, 9495 pass, 18 skippedawait settled()lines removed, those four tests fail and the other 15 pass.pnpm start(the vite dev server) in headless Chrome: 19 tests, 0 failed.pnpm type-check:internals,eslintandprettierpass.pnpm buildpasses and leaves no diff.Related
#21657 does the same move for
renderSettled()in therenderComponenttests. The two PRs touch different files.🤖 Generated with Claude Code