Bump @ember/test-helpers to ^4 in ember4 try scenarios#321
Merged
NullVoxPopuli merged 1 commit intoember-cli:nvp/its-vite-timefrom Apr 19, 2026
Conversation
`min-supported` and `ember-lts-4.12` were failing in vite build with:
[vite]: Rollup failed to resolve import "require" from
".../@ember/test-helpers/-internal/build-registry.js"
The line responsible is at the top of
`@ember/test-helpers@3.x/addon-test-support/@ember/test-helpers/-internal/build-registry.ts`:
import require, { has } from 'require';
This is the AMD `require` module provided by classic Ember's loader.js.
When vite/rollup processes this file (after `@embroider/compat` rewrites
it into the addon's `rewritten-packages` tree), there is no `require`
module to resolve and the build fails.
`@ember/test-helpers@4.0.0` dropped that import and re-implemented
build-registry on top of `@ember/-internals/container` and
`./-owner-mixin-imports.js`, so it no longer depends on a loader.js-style
`require`. Its peer is `ember-source >= 4.0.0`, which satisfies both the
min-supported scenario (~4.2.0) and ember-lts-4.12. `ember-qunit@^8.0.0`
peers `@ember/test-helpers: >=3.0.3`, so the bump does not violate it.
Also bump `@ember/test-waiters` to `^3.1.0` to stay within the window
expected by test-helpers 4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e965739
into
ember-cli:nvp/its-vite-time
18 of 20 checks passed
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-page-title
that referenced
this pull request
Apr 19, 2026
Three stacked runtime issues were blocking ember-lts-4.12 once the `require` import issue from ember-cli#321 cleared. All three affect the compat path (ENABLE_COMPAT_BUILD=true, ember4 deps overrides) and are hidden for ember-source >= 6 because the upstream code was rewritten. 1. "Cannot read properties of undefined (reading 'has')" at `makeComputedDecorator` → `COMPUTED_GETTERS.has(...)`. ember-source <= 5.x's `@ember/-internals/metal` has `let COMPUTED_GETTERS; if (DEBUG) { COMPUTED_GETTERS = new WeakSet(); }` paired with `assert(..., !COMPUTED_GETTERS.has(...))`. `DEBUG` comes from `@glimmer/env`, whose published default is `DEBUG = false`. Without babel-plugin-debug-macros processing ember-source, the init is tree-shaken while the `assert` predicate still evaluates eagerly, so `COMPUTED_GETTERS` is undefined at runtime. Alias `@glimmer/env` to a local shim that exports `DEBUG = true` so the init and the use stay consistent (ember-source >= 6 switched to `isDevelopingApp()` from `@embroider/macros`, which `buildMacros()` already handles — hence the problem is specific to the older Ember versions exercised by the compat scenarios). 2. "ReferenceError: requirejs is not defined" from ember-qunit's auto-loadTests. ember-qunit@8's `start()` calls `loadTests()` which uses `requirejs.entries` — there's no loader.js in a vite build. ember-qunit@9 dropped that call entirely. Pass `{ loadTests: false }` so `start()` skips the requirejs-based loader; tests/index.html already uses `import.meta.glob` to discover them. The option is safely ignored by ember-qunit 9. 3. "Cannot read properties of undefined (reading '_APPLICATION_TEMPLATE_WRAPPER')" from `@ember/test-helpers`'s `visit` and `setup-rendering-context`. test-helpers 4.x reads `global.EmberENV._APPLICATION_TEMPLATE_WRAPPER` to decide whether to look inside the `.ember-view` wrapper. In classic ember-cli apps the global is populated from index.html; here we need to set it ourselves from config. Assign `globalThis.EmberENV` in `test-helper.js`. test-helpers 5.x no longer reads this at all, so the assignment is harmless for non-compat scenarios. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-page-title
that referenced
this pull request
Apr 19, 2026
Three stacked runtime issues were blocking ember-lts-4.12 once the `require` import issue from ember-cli#321 cleared. All three affect the compat path (ENABLE_COMPAT_BUILD=true, ember4 deps overrides) and are hidden for ember-source >= 6 because the upstream code was rewritten. 1. "Cannot read properties of undefined (reading 'has')" at `makeComputedDecorator` → `COMPUTED_GETTERS.has(...)`. ember-source <= 5.x's `@ember/-internals/metal` has `let COMPUTED_GETTERS; if (DEBUG) { COMPUTED_GETTERS = new WeakSet(); }` paired with `assert(..., !COMPUTED_GETTERS.has(...))`. `DEBUG` comes from `@glimmer/env`, whose published default is `DEBUG = false`. Without something resolving `DEBUG` at compile time, rollup tree-shakes the init but the `assert` predicate still runs eagerly, so `COMPUTED_GETTERS` is undefined at runtime. Conditionally add `babel-plugin-debug-macros` (only when ENABLE_COMPAT_BUILD is set) with `flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }]` so the plugin inlines `DEBUG = true` in ember-source. The init and the use stay consistent. Non-compat scenarios don't need the plugin — modern ember-source uses `isDevelopingApp()` from `@embroider/macros`, which `buildMacros()` already handles — so gating on ENABLE_COMPAT_BUILD keeps the default build untouched. 2. "ReferenceError: requirejs is not defined" from ember-qunit's auto-loadTests. ember-qunit@8's `start()` calls `loadTests()` which uses `requirejs.entries` — there's no loader.js in a vite build. ember-qunit@9 dropped that call entirely. Pass `{ loadTests: false }` so `start()` skips the requirejs-based loader; tests/index.html already uses `import.meta.glob` to discover them. The option is safely ignored by ember-qunit 9. 3. "Cannot read properties of undefined (reading '_APPLICATION_TEMPLATE_WRAPPER')" from `@ember/test-helpers`'s `visit` and `setup-rendering-context`. test-helpers 4.x reads `global.EmberENV._APPLICATION_TEMPLATE_WRAPPER` to decide whether to look inside the `.ember-view` wrapper. In classic ember-cli apps the global is populated from index.html; here we need to set it ourselves from config. Assign `globalThis.EmberENV` in `test-helper.js`. test-helpers 5.x no longer reads this at all, so the assignment is harmless for non-compat scenarios. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-page-title
that referenced
this pull request
Apr 19, 2026
Two stacked runtime issues were blocking ember-lts-4.12 once the `require` import issue from ember-cli#321 cleared. Both only affect the compat path (ENABLE_COMPAT_BUILD=true, ember4 deps overrides) and are hidden for ember-source >= 6 because the upstream code was rewritten. 1. "Cannot read properties of undefined (reading 'has')" at `makeComputedDecorator` → `COMPUTED_GETTERS.has(...)`. ember-source <= 5.x's `@ember/-internals/metal` has `let COMPUTED_GETTERS; if (DEBUG) { COMPUTED_GETTERS = new WeakSet(); }` paired with `assert(..., !COMPUTED_GETTERS.has(...))`. `DEBUG` comes from `@glimmer/env`, whose published default is `DEBUG = false`. Without something resolving `DEBUG` at compile time, rollup tree-shakes the init but the `assert` predicate still runs eagerly, so `COMPUTED_GETTERS` is undefined at runtime. Conditionally add `babel-plugin-debug-macros` (only when ENABLE_COMPAT_BUILD is set) with `flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }]` so the plugin inlines `DEBUG = true` in ember-source. The init and the use stay consistent. Non-compat scenarios don't need the plugin — modern ember-source uses `isDevelopingApp()` from `@embroider/macros`, which `buildMacros()` already handles. 2. ember-qunit@8 + @ember/test-helpers@4 rely on classic-Ember globals that don't exist in a vite build: `start()` auto-calls `loadTests()` which iterates `requirejs.entries`, and `visit` reads `global.EmberENV._APPLICATION_TEMPLATE_WRAPPER`. Both were removed in ember-qunit@9 and @ember/test-helpers@5 respectively. Bump those two pins in the ember4 deps stanza so the scenario exercises the same surface modern scenarios do: ember-qunit: ^8.0.0 -> ^9.0.0 @ember/test-helpers: ^4.0.0 -> ^5.0.0 Both peer `ember-source >= 4.0.0`, so Ember 4.12 is still within the supported range. ember-qunit@9 peers `@ember/test-helpers >=3.0.3`, so the test-helpers bump stays within bounds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes the remaining
min-supportedandember-lts-4.12try-scenario failures on #317:Root cause
@ember/test-helpers@3.x(addon-test-support/@ember/test-helpers/-internal/build-registry.ts:6) starts with:This is the AMD-loader
requiremodule — a magic identifier provided at runtime by classic Ember'sloader.js. After@embroider/compatrewrites the package into.embroider/rewritten-packages/..., vite/rollup sees a plain bare importrequirewith no matching module and fails. Bothmin-supportedandember-lts-4.12hit this because theember4deps stanza intest-app/.try.mjspins@ember/test-helpers: ^3.2.1.Fix
@ember/test-helpers@4.0.0dropped the loader.jsrequireimport and reimplementedbuild-registryon top of@ember/-internals/containerand./-owner-mixin-imports.js. Its peer isember-source >= 4.0.0, which covers bothmin-supported(~4.2.0) andember-lts-4.12.ember-qunit@^8.0.0's peer is@ember/test-helpers: >=3.0.3, so bumping to^4.0.0stays within bounds.const ember4 = { - '@ember/test-helpers': '^3.2.1', - '@ember/test-waiters': '^3.0.0', + '@ember/test-helpers': '^4.0.0', + '@ember/test-waiters': '^3.1.0', '@embroider/compat': '^4.0.3', 'ember-qunit': '^8.0.0', 'ember-cli': '~4.12.0', };(
test-waitersbumped to^3.1.0to stay within the window test-helpers 4 expects.)Test plan
min-supportedandember-lts-4.12scenarios go greenember4overrides) remain unaffected — they already use test-helpers from the test-app's own^5.4.1🤖 Generated with Claude Code