ng test fails with NG8001 in a new NgModule app on 22.2.0
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- angular, typescript
- Área
- build-system, testing-qa
Línea de trabajo
Reproduce the failure with the provided ng test command, then inspect the Vitest runner behavior described since #34134, starting with app.spec.ts, app-module.ts, and tsconfig.spec.json. Trace which files are compiled through imports and verify the generated NgModule app passes on 22.2.0 without adding an import workaround.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
22.1.9
Description
In a new NgModule app, ng test fails on 22.2.0 with NG8001 for <router-outlet>. The same app generated with 22.1.9 passes.
Since #34134, the Vitest runner compiles the spec files, the setup and providers files, and the files they import. No spec imports app-module.ts, so it is not compiled, even though tsconfig.spec.json includes it.
Minimal Reproduction
npx @angular/[email protected] new repro --standalone=false --defaults
cd repro
npx ng test --watch=false
The generated app is not changed. src/app/app.html ends with <router-outlet />.
With @angular/[email protected], the same app passes (1 test file, 2 tests) when the @angular/* packages are pinned to ~22.1.0 before installing.
Adding import './app-module' at the top of src/app/app.spec.ts makes the tests pass on 22.2.0. Adding src/app/app-module.ts to files in tsconfig.spec.json does not.
Exception or Error
Application bundle generation failed. [1.373 seconds]
✘ [ERROR] NG8001: 'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. Find more at https://next.angular.dev/errors/NG8001 [plugin angular-compiler]
src/app/app.html:344:0:
344 │ <router-outlet />
╵ ~~~~~~~~~~~~~~~~~
Error occurs in the template of component App.
src/app/app.ts:7:15:
7 │ templateUrl: './app.html',
╵ ~~~~~~~~~~~~
Your Environment
Angular CLI : 22.2.0
Angular : 22.2.0
Node.js : 26.7.0
Package Manager : npm 11.19.0
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.2.0 │ ^22.2.0 │
│ @angular/cli │ 22.2.0 │ ^22.2.0 │
│ @angular/common │ 22.2.0 │ ^22.2.0 │
│ @angular/compiler │ 22.2.0 │ ^22.2.0 │
│ @angular/compiler-cli │ 22.2.0 │ ^22.2.0 │
│ @angular/core │ 22.2.0 │ ^22.2.0 │
│ @angular/forms │ 22.2.0 │ ^22.2.0 │
│ @angular/platform-browser │ 22.2.0 │ ^22.2.0 │
│ @angular/router │ 22.2.0 │ ^22.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.2 │
│ vitest │ 5.0.3 │ ^5.0.0 │
└───────────────────────────┴───────────────────┴───────────────────┘
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 23 h 27 min
- PR fusionados (30 d)
- 152
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-serverAbiertoarea: @angular/build gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
angular/angular-cli#33955 ·
Los mantenedores suelen responder en 1 día
-
area: @angular/cli gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/angular-cli#33055 · 1 comentario · 3 reacciones ·
Los mantenedores suelen responder en 1 día
-
area: @angular/build
Dificultad 4/5 3-5 días Aptitud para principiantes 65/100
angular/angular-cli#34257 ·
Los mantenedores suelen responder en 1 día
-
Add CSP nonce to <link rel="stylesheet"> tags when ngCspNonce is setPosiblemente ocupada @alan-agius4 la tomó hoy. Abiertoarea: @angular/build
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
angular/angular-cli#34255 ·
Los mantenedores suelen responder en 1 día
-
area: @angular/build
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
angular/angular-cli#34250 ·
Los mantenedores suelen responder en 1 día
Todos los issues de angular/angular-cli
Issues similares
-
fix: txId branch of the contract-state streams drops every state after the named transactionAbiertobot:ai-assisted status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
midnightntwrk/midnight-js#1424 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
mksglu/context-mode#1268 ·
Los mantenedores suelen responder en 5 días
-
Edit:Abiertocheck:failed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
iptv-org/iptv#54352 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Table] reserveSelectedRowOnPaginate=false 时表头全选包含其他页数据Posiblemente ocupada @dvd233 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Tencent/tdesign-react#4416 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area:widget bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
interledger/publisher-tools#894 ·
Los mantenedores suelen responder en 1 día