| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 93c5bc8 commit de31cfc
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,10 +32,10 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 32 | 32 | it('should use custom reporters defined in runnerConfig file', async () => { | |
| 33 | 33 | harness.useTarget('test', { | |
| 34 | 34 | ...BASE_OPTIONS, | |
| 35 | - runnerConfig: 'vitest.config.ts', | ||
| 35 | + runnerConfig: 'vitest.config.mts', | ||
| 36 | 36 | }); | |
| 37 | 37 | ||
| 38 | - harness.writeFile('vitest.config.ts', VITEST_CONFIG_CONTENT); | ||
| 38 | + harness.writeFile('vitest.config.mts', VITEST_CONFIG_CONTENT); | ||
| 39 | 39 | ||
| 40 | 40 | const { result } = await harness.executeOnce(); | |
| 41 | 41 | expect(result?.success).toBeTrue(); | |
@@ -45,11 +45,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 45 | 45 | it('should use custom reporters and outputFile defined as an object in runnerConfig file', async () => { | |
| 46 | 46 | harness.useTarget('test', { | |
| 47 | 47 | ...BASE_OPTIONS, | |
| 48 | - runnerConfig: 'vitest.config.ts', | ||
| 48 | + runnerConfig: 'vitest.config.mts', | ||
| 49 | 49 | }); | |
| 50 | 50 | ||
| 51 | 51 | harness.writeFile( | |
| 52 | - 'vitest.config.ts', | ||
| 52 | + 'vitest.config.mts', | ||
| 53 | 53 | ` | |
| 54 | 54 | import { defineConfig } from 'vitest/config'; | |
| 55 | 55 | export default defineConfig({ | |
@@ -71,12 +71,12 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 71 | 71 | it('should preserve custom coverage options (e.g. clean: false) from runnerConfig file', async () => { | |
| 72 | 72 | harness.useTarget('test', { | |
| 73 | 73 | ...BASE_OPTIONS, | |
| 74 | - runnerConfig: 'vitest.config.ts', | ||
| 74 | + runnerConfig: 'vitest.config.mts', | ||
| 75 | 75 | coverage: true, | |
| 76 | 76 | }); | |
| 77 | 77 | ||
| 78 | 78 | harness.writeFile( | |
| 79 | - 'vitest.config.ts', | ||
| 79 | + 'vitest.config.mts', | ||
| 80 | 80 | ` | |
| 81 | 81 | import { defineConfig } from 'vitest/config'; | |
| 82 | 82 | export default defineConfig({ | |
@@ -102,11 +102,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 102 | 102 | it('should override reporters defined in runnerConfig file when CLI option is present', async () => { | |
| 103 | 103 | harness.useTarget('test', { | |
| 104 | 104 | ...BASE_OPTIONS, | |
| 105 | - runnerConfig: 'vitest.config.ts', | ||
| 105 | + runnerConfig: 'vitest.config.mts', | ||
| 106 | 106 | reporters: ['default'], | |
| 107 | 107 | }); | |
| 108 | 108 | ||
| 109 | - harness.writeFile('vitest.config.ts', VITEST_CONFIG_CONTENT); | ||
| 109 | + harness.writeFile('vitest.config.mts', VITEST_CONFIG_CONTENT); | ||
| 110 | 110 | ||
| 111 | 111 | const { result } = await harness.executeOnce(); | |
| 112 | 112 | expect(result?.success).toBeTrue(); | |
@@ -117,12 +117,12 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 117 | 117 | it('should use custom reportsDirectory defined in runnerConfig file', async () => { | |
| 118 | 118 | harness.useTarget('test', { | |
| 119 | 119 | ...BASE_OPTIONS, | |
| 120 | - runnerConfig: 'vitest.config.ts', | ||
| 120 | + runnerConfig: 'vitest.config.mts', | ||
| 121 | 121 | coverage: true, | |
| 122 | 122 | }); | |
| 123 | 123 | ||
| 124 | 124 | harness.writeFile( | |
| 125 | - 'vitest.config.ts', | ||
| 125 | + 'vitest.config.mts', | ||
| 126 | 126 | ` | |
| 127 | 127 | import { defineConfig } from 'vitest/config'; | |
| 128 | 128 | export default defineConfig({ | |
@@ -144,11 +144,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 144 | 144 | harness.useTarget('test', { | |
| 145 | 145 | ...BASE_OPTIONS, | |
| 146 | 146 | coverage: true, | |
| 147 | - runnerConfig: 'vitest.config.ts', | ||
| 147 | + runnerConfig: 'vitest.config.mts', | ||
| 148 | 148 | }); | |
| 149 | 149 | ||
| 150 | 150 | harness.writeFile( | |
| 151 | - 'vitest.config.ts', | ||
| 151 | + 'vitest.config.mts', | ||
| 152 | 152 | ` | |
| 153 | 153 | import { defineConfig } from 'vitest/config'; | |
| 154 | 154 | export default defineConfig({ | |
@@ -167,11 +167,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 167 | 167 | it('should enable coverage when set in runnerConfig file without builder option', async () => { | |
| 168 | 168 | harness.useTarget('test', { | |
| 169 | 169 | ...BASE_OPTIONS, | |
| 170 | - runnerConfig: 'vitest.config.ts', | ||
| 170 | + runnerConfig: 'vitest.config.mts', | ||
| 171 | 171 | }); | |
| 172 | 172 | ||
| 173 | 173 | harness.writeFile( | |
| 174 | - 'vitest.config.ts', | ||
| 174 | + 'vitest.config.mts', | ||
| 175 | 175 | ` | |
| 176 | 176 | import { defineConfig } from 'vitest/config'; | |
| 177 | 177 | export default defineConfig({ | |
@@ -192,11 +192,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 192 | 192 | it('should exclude test files based on runnerConfig file', async () => { | |
| 193 | 193 | harness.useTarget('test', { | |
| 194 | 194 | ...BASE_OPTIONS, | |
| 195 | - runnerConfig: 'vitest.config.ts', | ||
| 195 | + runnerConfig: 'vitest.config.mts', | ||
| 196 | 196 | }); | |
| 197 | 197 | ||
| 198 | 198 | harness.writeFile( | |
| 199 | - 'vitest.config.ts', | ||
| 199 | + 'vitest.config.mts', | ||
| 200 | 200 | ` | |
| 201 | 201 | import { defineConfig } from 'vitest/config'; | |
| 202 | 202 | export default defineConfig({ | |
@@ -240,12 +240,12 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 240 | 240 | harness.useTarget('test', { | |
| 241 | 241 | ...BASE_OPTIONS, | |
| 242 | 242 | coverage: true, | |
| 243 | - runnerConfig: 'vitest.config.ts', | ||
| 243 | + runnerConfig: 'vitest.config.mts', | ||
| 244 | 244 | coverageExclude: ['src/app/cli-excluded.ts'], | |
| 245 | 245 | }); | |
| 246 | 246 | ||
| 247 | 247 | harness.writeFile( | |
| 248 | - 'vitest.config.ts', | ||
| 248 | + 'vitest.config.mts', | ||
| 249 | 249 | ` | |
| 250 | 250 | import { defineConfig } from 'vitest/config'; | |
| 251 | 251 | export default defineConfig({ | |
@@ -292,11 +292,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 292 | 292 | it('should allow overriding globals to false via runnerConfig file', async () => { | |
| 293 | 293 | harness.useTarget('test', { | |
| 294 | 294 | ...BASE_OPTIONS, | |
| 295 | - runnerConfig: 'vitest.config.ts', | ||
| 295 | + runnerConfig: 'vitest.config.mts', | ||
| 296 | 296 | }); | |
| 297 | 297 | ||
| 298 | 298 | harness.writeFile( | |
| 299 | - 'vitest.config.ts', | ||
| 299 | + 'vitest.config.mts', | ||
| 300 | 300 | ` | |
| 301 | 301 | import { defineConfig } from 'vitest/config'; | |
| 302 | 302 | export default defineConfig({ | |
@@ -325,11 +325,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 325 | 325 | it('should initialize environment even when globals are disabled in runnerConfig file', async () => { | |
| 326 | 326 | harness.useTarget('test', { | |
| 327 | 327 | ...BASE_OPTIONS, | |
| 328 | - runnerConfig: 'vitest.config.ts', | ||
| 328 | + runnerConfig: 'vitest.config.mts', | ||
| 329 | 329 | }); | |
| 330 | 330 | ||
| 331 | 331 | harness.writeFile( | |
| 332 | - 'vitest.config.ts', | ||
| 332 | + 'vitest.config.mts', | ||
| 333 | 333 | ` | |
| 334 | 334 | import { defineConfig } from 'vitest/config'; | |
| 335 | 335 | export default defineConfig({ | |
@@ -357,11 +357,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 357 | 357 | it('should fail when a DOM-dependent test is run in a node environment', async () => { | |
| 358 | 358 | harness.useTarget('test', { | |
| 359 | 359 | ...BASE_OPTIONS, | |
| 360 | - runnerConfig: 'vitest.config.ts', | ||
| 360 | + runnerConfig: 'vitest.config.mts', | ||
| 361 | 361 | }); | |
| 362 | 362 | ||
| 363 | 363 | harness.writeFile( | |
| 364 | - 'vitest.config.ts', | ||
| 364 | + 'vitest.config.mts', | ||
| 365 | 365 | ` | |
| 366 | 366 | import { defineConfig } from 'vitest/config'; | |
| 367 | 367 | export default defineConfig({ | |
@@ -379,11 +379,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 379 | 379 | it('should warn and ignore "test.projects" option from runnerConfig file', async () => { | |
| 380 | 380 | harness.useTarget('test', { | |
| 381 | 381 | ...BASE_OPTIONS, | |
| 382 | - runnerConfig: 'vitest.config.ts', | ||
| 382 | + runnerConfig: 'vitest.config.mts', | ||
| 383 | 383 | }); | |
| 384 | 384 | ||
| 385 | 385 | harness.writeFile( | |
| 386 | - 'vitest.config.ts', | ||
| 386 | + 'vitest.config.mts', | ||
| 387 | 387 | ` | |
| 388 | 388 | import { defineConfig } from 'vitest/config'; | |
| 389 | 389 | export default defineConfig({ | |
@@ -411,11 +411,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 411 | 411 | it('should warn and ignore "test.include" option from runnerConfig file', async () => { | |
| 412 | 412 | harness.useTarget('test', { | |
| 413 | 413 | ...BASE_OPTIONS, | |
| 414 | - runnerConfig: 'vitest.config.ts', | ||
| 414 | + runnerConfig: 'vitest.config.mts', | ||
| 415 | 415 | }); | |
| 416 | 416 | ||
| 417 | 417 | harness.writeFile( | |
| 418 | - 'vitest.config.ts', | ||
| 418 | + 'vitest.config.mts', | ||
| 419 | 419 | ` | |
| 420 | 420 | import { defineConfig } from 'vitest/config'; | |
| 421 | 421 | export default defineConfig({ | |
@@ -444,11 +444,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 444 | 444 | harness.useTarget('test', { | |
| 445 | 445 | ...BASE_OPTIONS, | |
| 446 | 446 | watch: false, | |
| 447 | - runnerConfig: 'vitest.config.ts', | ||
| 447 | + runnerConfig: 'vitest.config.mts', | ||
| 448 | 448 | }); | |
| 449 | 449 | ||
| 450 | 450 | harness.writeFile( | |
| 451 | - 'vitest.config.ts', | ||
| 451 | + 'vitest.config.mts', | ||
| 452 | 452 | ` | |
| 453 | 453 | import { defineConfig } from 'vitest/config'; | |
| 454 | 454 | export default defineConfig({ | |
@@ -476,11 +476,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 476 | 476 | it('should warn about performance when "test.exclude" option is in runnerConfig file', async () => { | |
| 477 | 477 | harness.useTarget('test', { | |
| 478 | 478 | ...BASE_OPTIONS, | |
| 479 | - runnerConfig: 'vitest.config.ts', | ||
| 479 | + runnerConfig: 'vitest.config.mts', | ||
| 480 | 480 | }); | |
| 481 | 481 | ||
| 482 | 482 | harness.writeFile( | |
| 483 | - 'vitest.config.ts', | ||
| 483 | + 'vitest.config.mts', | ||
| 484 | 484 | ` | |
| 485 | 485 | import { defineConfig } from 'vitest/config'; | |
| 486 | 486 | export default defineConfig({ | |
@@ -508,11 +508,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 508 | 508 | it(`should append "test.setupFiles" (string) from runnerConfig to the CLI's setup`, async () => { | |
| 509 | 509 | harness.useTarget('test', { | |
| 510 | 510 | ...BASE_OPTIONS, | |
| 511 | - runnerConfig: 'vitest.config.ts', | ||
| 511 | + runnerConfig: 'vitest.config.mts', | ||
| 512 | 512 | }); | |
| 513 | 513 | ||
| 514 | 514 | harness.writeFile( | |
| 515 | - 'vitest.config.ts', | ||
| 515 | + 'vitest.config.mts', | ||
| 516 | 516 | ` | |
| 517 | 517 | import { defineConfig } from 'vitest/config'; | |
| 518 | 518 | export default defineConfig({ | |
@@ -542,11 +542,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 542 | 542 | it(`should append "test.setupFiles" (array) from runnerConfig to the CLI's setup`, async () => { | |
| 543 | 543 | harness.useTarget('test', { | |
| 544 | 544 | ...BASE_OPTIONS, | |
| 545 | - runnerConfig: 'vitest.config.ts', | ||
| 545 | + runnerConfig: 'vitest.config.mts', | ||
| 546 | 546 | }); | |
| 547 | 547 | ||
| 548 | 548 | harness.writeFile( | |
| 549 | - 'vitest.config.ts', | ||
| 549 | + 'vitest.config.mts', | ||
| 550 | 550 | ` | |
| 551 | 551 | import { defineConfig } from 'vitest/config'; | |
| 552 | 552 | export default defineConfig({ | |
@@ -578,11 +578,11 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 578 | 578 | it('should merge and apply custom Vite plugins from runnerConfig file', async () => { | |
| 579 | 579 | harness.useTarget('test', { | |
| 580 | 580 | ...BASE_OPTIONS, | |
| 581 | - runnerConfig: 'vitest.config.ts', | ||
| 581 | + runnerConfig: 'vitest.config.mts', | ||
| 582 | 582 | }); | |
| 583 | 583 | ||
| 584 | 584 | harness.writeFile( | |
| 585 | - 'vitest.config.ts', | ||
| 585 | + 'vitest.config.mts', | ||
| 586 | 586 | ` | |
| 587 | 587 | import { defineConfig } from 'vitest/config'; | |
| 588 | 588 | export default defineConfig({ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,10 +31,10 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 31 | 31 | ||
| 32 | 32 | describe('Vitest Runner', () => { | |
| 33 | 33 | it('should use a specified config file path', async () => { | |
| 34 | - harness.writeFile('custom-vitest.config.ts', VITEST_CONFIG_CONTENT); | ||
| 34 | + harness.writeFile('custom-vitest.config.mts', VITEST_CONFIG_CONTENT); | ||
| 35 | 35 | harness.useTarget('test', { | |
| 36 | 36 | ...BASE_OPTIONS, | |
| 37 | - runnerConfig: 'custom-vitest.config.ts', | ||
| 37 | + runnerConfig: 'custom-vitest.config.mts', | ||
| 38 | 38 | }); | |
| 39 | 39 | ||
| 40 | 40 | const { result } = await harness.executeOnce(); | |
@@ -96,7 +96,7 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 96 | 96 | ||
| 97 | 97 | it('should find and use a `vitest-base.config.js` in the workspace root', async () => { | |
| 98 | 98 | // This file should be ignored because the new logic looks for `vitest-base.config.*`. | |
| 99 | - harness.writeFile('vitest.config.ts', VITEST_CONFIG_CONTENT); | ||
| 99 | + harness.writeFile('vitest.config.mts', VITEST_CONFIG_CONTENT); | ||
| 100 | 100 | // The workspace root is the directory containing the project root in the test harness. | |
| 101 | 101 | harness.writeFile('vitest-base.config.js', VITEST_CONFIG_CONTENT); | |
| 102 | 102 | harness.useTarget('test', { | |
@@ -113,7 +113,7 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => { | |||
| 113 | 113 | it('should fallback to in-memory config when no base config is found', async () => { | |
| 114 | 114 | // This file should be ignored because the new logic looks for `vitest-base.config.*` | |
| 115 | 115 | // and when `runnerConfig` is true, it should not fall back to the default search. | |
| 116 | - harness.writeFile('vitest.config.ts', VITEST_CONFIG_CONTENT); | ||
| 116 | + harness.writeFile('vitest.config.mts', VITEST_CONFIG_CONTENT); | ||
| 117 | 117 | harness.useTarget('test', { | |
| 118 | 118 | ...BASE_OPTIONS, | |
| 119 | 119 | runnerConfig: true, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,15 @@ | |||
| 1 | 1 | import { ng } from '../../utils/process'; | |
| 2 | 2 | import { applyVitestBuilder } from '../../utils/vitest'; | |
| 3 | 3 | import assert from 'node:assert'; | |
| 4 | - import { installPackage } from '../../utils/packages'; | ||
| 5 | 4 | import { expectFileToExist, readFile } from '../../utils/fs'; | |
| 6 | 5 | import { updateJsonFile } from '../../utils/project'; | |
| 7 | 6 | ||
| 8 | 7 | export default async function (): Promise<void> { | |
| 9 | - await applyVitestBuilder(); | ||
| 10 | - | ||
| 11 | 8 | // Install ONLY Istanbul coverage package. | |
| 12 | 9 | // This will trigger the auto-detection logic to use Istanbul even for Node tests. | |
| 13 | - await installPackage('@vitest/coverage-istanbul@4'); | ||
| 10 | + await applyVitestBuilder({ | ||
| 11 | + coverageIstanbul: true, | ||
| 12 | + }); | ||
| 14 | 13 | ||
| 15 | 14 | // Use the 'json' reporter to get a machine-readable output for assertions. | |
| 16 | 15 | await updateJsonFile('angular.json', (json) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,13 @@ | |||
| 1 | 1 | import assert from 'node:assert/strict'; | |
| 2 | 2 | import { applyVitestBuilder } from '../../utils/vitest'; | |
| 3 | 3 | import { ng } from '../../utils/process'; | |
| 4 | - import { installPackage } from '../../utils/packages'; | ||
| 5 | 4 | import { expectFileToExist, readFile } from '../../utils/fs'; | |
| 6 | 5 | ||
| 7 | 6 | export default async function (): Promise<void> { | |
| 8 | - await applyVitestBuilder(); | ||
| 9 | - await installPackage('playwright@1'); | ||
| 10 | - await installPackage('@vitest/browser-playwright@4'); | ||
| 11 | - await installPackage('@vitest/coverage-v8@4'); | ||
| 7 | + await applyVitestBuilder({ | ||
| 8 | + playwright: true, | ||
| 9 | + coverageV8: true, | ||
| 10 | + }); | ||
| 12 | 11 | ||
| 13 | 12 | // Run tests with coverage in browser mode. | |
| 14 | 13 | // We use the default passing tests generated for the project. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments