Skip to content

[BUGFIX] Fix runtime/lint errors in StrictResolver tests and add missing pluralizations#21403

Merged
NullVoxPopuli merged 5 commits into
emberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:fix-lint-basic-test
May 14, 2026
Merged

[BUGFIX] Fix runtime/lint errors in StrictResolver tests and add missing pluralizations#21403
NullVoxPopuli merged 5 commits into
emberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:fix-lint-basic-test

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown
Contributor

Summary

PR #21303's Linting and Basic Test CI jobs are failing on the same root cause: line 185 of packages/@ember/engine/tests/resolver/basic-test.js uses the QUnit global module(...) instead of the imported QUnit.module(...) used by the rest of the file.

  • Lint error:
    packages/@ember/engine/tests/resolver/basic-test.js
      185:3  error  Unexpected global `module`  qunit/no-global-module-test
    
  • Runtime failure on basic test bundle:
    Global error: Uncaught TypeError: test is not a function at .../index.html/?, line 0
    

The fix is a one-line change to use QUnit.module(...) consistently.

Test plan

  • pnpm lint passes locally (was failing only on this rule)
  • pnpm build:js succeeds locally
  • CI's Linting job passes
  • CI's Basic Test job passes

🤖 Generated with Claude Code

NullVoxPopuli-ai-agent and others added 2 commits May 13, 2026 19:35
The nested 'weird scenarios' module was using the QUnit global `module`
instead of `QUnit.module`, which fails the `qunit/no-global-module-test`
lint rule and also breaks the test bundle at runtime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Use the global `QUnit` in the resolver test files instead of
  `import * as QUnit from 'qunit'`. The vite virtual qunit module
  only exports `q`, so the namespace import produces `{ q }` and
  destructuring `test` / `module` from it yields `undefined`. This
  caused "Uncaught TypeError: test is not a function" at script load
  and prevented the entire test bundle from running. All other Ember
  test files in this repo already use `QUnit` as a global.

- Add `helper` and `service` to `KNOWN_EASY_PLURALS`. The PR's tests
  (resolves the standard ember types via default pluralization,
  module paths with ./ prefix are normalized, etc.) expect
  `service:foo -> services/foo` and `helper:foo -> helpers/foo`,
  but the resolver was leaving them un-pluralized.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent changed the title Fix module global lint error in StrictResolver basic-test [BUGFIX] Fix runtime/lint errors in StrictResolver tests and add missing pluralizations May 14, 2026
NullVoxPopuli-ai-agent and others added 3 commits May 13, 2026 21:50
The generated app.js template iterates the outer scenarios' `project`
parameter instead of its own inner `modules` parameter — at runtime in
the app, `project` is undefined, so the smoke app crashes at load with
`ReferenceError: project is not defined`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The PR adds @ember/engine/lib/strict-resolver.ts as a new entrypoint
which is fully tree-shakable. Node.js Tests' tree-shakability snapshot
needs to include it. This check was skipped on the PR's original CI
because Basic Test failed first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
\`compatModules\` from \`@embroider/virtual/compat-modules\` emits keys
shaped like \`<modulePrefix>/<rest>\` (e.g.
\`v2-app-template/routes/example-gjs-route\`). The strict resolver
expects \`./<rest>\` (or just \`<rest>\` — leading \`./\` is normalized
off).

The previous regex \`new RegExp(\`/\${config.modulePrefix}\\//\`)\`
was buggy two ways:

- In a template literal, \`\\/\` is just \`/\` (the backslash before a
  slash is not an escape sequence in a string), so the pattern
  actually was \`/<modulePrefix>//\` — a literal double slash.
- The leading slash required a slash before the prefix, but
  compatModules' keys do not have one.

Together those meant the regex never matched any key, so the strict
resolver received \`<modulePrefix>/routes/example-gjs-route\` and
could not resolve \`route:example-gjs-route\`. The router then
threw \`UnrecognizedURLError\` on the smoke acceptance test.

Replace the regex with a plain \`startsWith\` / \`slice\` since the
modulePrefix can contain regex-special characters and a plain string
strip is unambiguous. This makes the \`strictResolver-basics\` smoke
test (both regular and Deprecations Removed variants) pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli merged commit 3378132 into emberjs:nvp/strict-resolver-rfc-1132 May 14, 2026
41 checks passed
@NullVoxPopuli NullVoxPopuli deleted the fix-lint-basic-test branch May 14, 2026 02:56
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.

2 participants