Commit 3378132
[BUGFIX] Fix runtime/lint errors in StrictResolver tests and add missing pluralizations (#21403)
* Fix `module` global lint error in StrictResolver basic-test
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.
* Fix runtime errors and add missing pluralizations
- 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>
* Fix `project is not defined` in strictResolver smoke scenario
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>
* Add strict-resolver.js to tree-shakability snapshots
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>
* Fix `fixModulePrefix` regex in strictResolver smoke scenario
\`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>
---------
Co-authored-by: NullVoxPopuli-ai-agent <theprecognition+claude@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5097c98 commit 3378132
5 files changed
Lines changed: 16 additions & 10 deletions
File tree
- packages/@ember/engine
- lib
- tests/resolver
- smoke-tests/scenarios
- tests/node-vitest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | | - | |
| 8 | + | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
43 | 47 | | |
44 | | - | |
45 | | - | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
0 commit comments