angular-cli
angular-cli copied to clipboard
jest in v16 is not working in multiple project
Is this a bug report or a feature request?
- [X] Bug Report
- [ ] Feature Request
Please provide the steps to reproduce the issue [Bug Report only]
Sample repository is in [email protected]:sangb-han/angv16_multi.git .
Create project like followings
> ng new angv16_multi --no-create-application
> cd angv16_multi
> ng g project sample_app
> ng g library sample
After that, jest has been configured like in angular blog.
If I ran in workspace with single project, there was no problem. But in workspace with multiple project, test with jest failed.
Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]
All test run successfully.
Please provide a screenshot if possible [Bug Report only]
ged:angv16_multi% ng test
Node.js version v19.8.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
NOTE: The Jest builder is currently EXPERIMENTAL and not ready for production use.
The esbuild-based browser application builder ('browser-esbuild') is currently in developer preview and is not yet recommended for production use. For additional information, please see https://angular.io/guide/esbuild
✘ [ERROR] File 'projects/sample/src/lib/sample.service.spec.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
✘ [ERROR] File 'projects/sample/src/lib/sample.component.spec.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
(node:40802) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS dist/test-out/app.component.spec.mjs
AppComponent
✓ should create the app (47 ms)
✓ should have as title 'sample-app' (9 ms)
✓ should render title (11 ms)
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 0.493 s
Ran all test suites.
NOTE: The Jest builder is currently EXPERIMENTAL and not ready for production use.
The esbuild-based browser application builder ('browser-esbuild') is currently in developer preview and is not yet recommended for production use. For additional information, please see https://angular.io/guide/esbuild
✘ [ERROR] File 'projects/sample-app/src/app/app.component.spec.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
(node:40831) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS dist/test-out/app.component.spec.mjs
AppComponent
✓ should create the app (50 ms)
✓ should have as title 'sample-app' (10 ms)
✓ should render title (11 ms)
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 0.402 s
Ran all test suites.
Please provide the exception or error you saw [Bug Report only]
In screenshot, test is failed.
Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]
no
Description [Feature Request only]
No response
Proposed solution [Feature Request only]
No response
Alternatives considered [Feature Request only]
No response
hey, any progress on this issue?
Any progress what so ever?
try add include property to angular.json
{
"projects": {
"sample_app": {
"architect": {
"test": {
"builder": "@angular-devkit/build-angular:jest",
"options": {
"include": ["projects/sample_app/src/**/*.spec.ts", "projects/sample_app/src/**/*.d.ts"],
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/sample_app/tsconfig.spec.json"
}
}
}
},
"sample ": {
"architect": {
"test": {
"builder": "@angular-devkit/build-angular:jest",
"options": {
"include": ["projects/sample/src/**/*.spec.ts", "projects/sample/src/**/*.d.ts"],
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/sample/tsconfig.spec.json"
}
}
}
}
}
}