| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 956ccaa commit 36978db
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,6 +106,14 @@ export async function createVitestConfigPlugin( | |||
| 106 | 106 | delete testConfig.watch; | |
| 107 | 107 | } | |
| 108 | 108 | ||
| 109 | + if (testConfig?.exclude) { | ||
| 110 | + this.warn( | ||
| 111 | + 'The "test.exclude" option in the Vitest configuration file is evaluated after ' + | ||
| 112 | + 'tests are compiled. For better build performance, please use the Angular CLI ' + | ||
| 113 | + '"exclude" option instead.', | ||
| 114 | + ); | ||
| 115 | + } | ||
| 116 | + | ||
| 109 | 117 | // Merge user-defined plugins from the Vitest config with the CLI's internal plugins. | |
| 110 | 118 | if (config.plugins) { | |
| 111 | 119 | const userPlugins = config.plugins.filter( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,6 +348,38 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 348 | 348 | // ); | |
| 349 | 349 | }); | |
| 350 | 350 | ||
| 351 | + it('should warn about performance when "test.exclude" option is in runnerConfig file', async () => { | ||
| 352 | + harness.useTarget('test', { | ||
| 353 | + ...BASE_OPTIONS, | ||
| 354 | + runnerConfig: 'vitest.config.ts', | ||
| 355 | + }); | ||
| 356 | + | ||
| 357 | + harness.writeFile( | ||
| 358 | + 'vitest.config.ts', | ||
| 359 | + ` | ||
| 360 | + import { defineConfig } from 'vitest/config'; | ||
| 361 | + export default defineConfig({ | ||
| 362 | + test: { | ||
| 363 | + exclude: ['src/app/non-existent.spec.ts'], | ||
| 364 | + }, | ||
| 365 | + }); | ||
| 366 | + `, | ||
| 367 | + ); | ||
| 368 | + | ||
| 369 | + const { result, logs } = await harness.executeOnce(); | ||
| 370 | + expect(result?.success).toBeTrue(); | ||
| 371 | + | ||
| 372 | + // TODO: Re-enable once Vite logs are remapped through build system | ||
| 373 | + // expect(logs).toContain( | ||
| 374 | + // jasmine.objectContaining({ | ||
| 375 | + // level: 'warn', | ||
| 376 | + // message: jasmine.stringMatching( | ||
| 377 | + // 'The "test.exclude" option in the Vitest configuration file is evaluated after', | ||
| 378 | + // ), | ||
| 379 | + // }), | ||
| 380 | + // ); | ||
| 381 | + }); | ||
| 382 | + | ||
| 351 | 383 | it(`should append "test.setupFiles" (string) from runnerConfig to the CLI's setup`, async () => { | |
| 352 | 384 | harness.useTarget('test', { | |
| 353 | 385 | ...BASE_OPTIONS, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments