-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
test - ng test
Is this a regression?
- Since its using vitest that was not in Angular 20, I do not believe this is a regression. But in previous NG Test tasks, there would not be the entire output at the end of the test and it would not keep showing up every time I rebuild when it is in watch mode.
The previous version in which this bug was not present was
No response
Description
I've migrated from @analogjs/vitest to AngularCLI Vitest with Angular 21 and noticed I'm getting the entire chunk output when the tests are done, or when it is reloading, tests and then it outputs. Not only is this a long list for my app, but since it posts after the testresults, it prevents me from easily seeing what the results are. I think it doesn't show those chunks when I don't have a runnerconfig set up.
Personally I find the information from the chunkslist to already be extremely minor and would be fine if it would post a summary of what was created and leave it at that. But also I would expect it to output before the test results as well.
Minimal Reproduction
Set up a runner config:
"test": {
"builder": "@angular/build:unit-test",
"options": {
"buildTarget": "project:build:development",
"providersFile": "src/testing/test-providers.ts",
"runnerConfig": "vitest.config.ts",
"setupFiles": [
"src/testing/test-setup.ts"
],
"tsConfig": "tsconfig.spec.json"
}
}
Have a runner config like so:
import { playwright } from '@vitest/browser-playwright';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
const configDirectory = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig({
resolve: {
alias: {
// Force browser-safe UUID entry in browser mode tests to avoid node:crypto imports. These imports are not available in nodejs (which is when it compiles the tests) but are available in a real world browser
uuid: path.resolve(configDirectory, 'node_modules/uuid/dist/index.js'),
},
tsconfigPaths: true,
},
test: {
allowOnly: true,
attachmentsDir: 'test-results/unit-results/attachments',
browser: {
enabled: true,
headless: true,
instances: [
{ browser: 'chromium' },
],
provider: playwright({
launchOptions: {
args: ['--disable-dev-shm-usage'],
},
}),
screenshotDirectory: 'test-results/unit-results/screenshots',
},
coverage: {
enabled: true,
provider: 'v8',
reporter: [
['lcovonly'],
['text'],
['json', { 'file': 'coverage.json' }],
['html', { 'file': 'index.html' }]
],
reportsDirectory: './test-results/unit-coverage',
exclude: ['**/testing/**/*', '**/*.interfaces.ts', '**/*.constants.ts', '**/*.config.ts', '**/environments/**/*', 'src/**/*.routes.ts', 'main.ts', '**/assets/**/*', '**/*.html', '**/*.css'],
},
exclude: ['node_modules', 'dist', 'test-results/**', 'coverage/**', 'src/e2e/**', 'src/main.ts', '**/*.html'],
expect: {
requireAssertions: true,
},
globals: true,
reporters: [
'tree',
['json', { outputFile: './test-results/unit-results/json-report.json', silent: true }],
['junit', { outputFile: './test-results/unit-results/junit-report.xml', silent: true }],
],
server: {
deps: {
inline: [
/@angular/,
'@ngneat/spectator',
'ng-mocks',
/@ngneat/,
/@ngx-/,
/@ng-/,
],
},
},
},
});
Exception or Error
... more test results...
✓ should get percentage value 1ms
Test Files 244 passed (244)
Tests 3938 passed (3938)
Start at 13:52:43
Duration 18.31s (transform 0ms, setup 14.66s, import 17.09s, tests 50.54s, environment 0ms)
JSON report written to C:/Code/<project>/test-results/unit-results/json-report.json
JUNIT report written to C:/Code/<project>/test-results/unit-results/junit-report.xml
PASS Waiting for file changes...
press h to show help, press q to quit
Initial chunk files
| Names
| Raw size
spec-app-features-testing-core-elements-core-elements.component.js
| spec-app-features-testing-core-elements-core-elements.component
| 195.10 kB |
styles.css
| styles
| 157.58 kB |
spec-app-features-dashboard-search.component.js
| spec-app-features-dashboard-search.component
| 91.48 kB |
spec-app-features-some-definition.component.js
| spec-app-features-some-definition.component
| 69.76 kB |
spec-app-features-some-preset.component.js
| spec-app-features-some-preset.component
| 69.58 kB |
chunk-WF54WXJ5.js
| -
| 64.49 kB |
... list of 200+ files and chunks created ...
Your Environment
Windows + PNPM + Angular 21, but also happens on MacOS.
Anything else relevant?
I've always wondered why the generation of chunks did not have any options to moderate its output, but now that for each live reloading test it keeps outputting the same stuff which requires a lot of scrolling, is making it harder to test my work continuously. So I hope that not only this apparent bug gets fixed, but perhaps we get some options changing the output, since in many cases I don't really need this information.