Skip to content

Commit 917af12

Browse files
committed
fix(@angular/build): use date/time based output path for vitest unit-test
The output directory name for the unit-test code when using the experimental `unit-test` builder with the `vitest` runner will now use a value based on the date and time of test execution instead of only a random UUID. This value improves the discoverability of a test execution when multiple have been performed.
1 parent 8f860cc commit 917af12

File tree

1 file changed

+8
-1
lines changed
  • packages/angular/build/src/builders/unit-test

1 file changed

+8
-1
lines changed

packages/angular/build/src/builders/unit-test/builder.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export async function* execute(
113113
buildTargetOptions.polyfills.push('zone.js/testing');
114114
}
115115

116-
const outputPath = path.join(context.workspaceRoot, 'dist/test-out', randomUUID());
116+
const outputPath = path.join(context.workspaceRoot, generateOutputPath());
117117
const buildOptions: ApplicationBuilderInternalOptions = {
118118
...buildTargetOptions,
119119
watch: normalizedOptions.watch,
@@ -343,3 +343,10 @@ function setupBrowserConfiguration(
343343

344344
return { browser };
345345
}
346+
347+
function generateOutputPath(): string {
348+
const datePrefix = new Date().toISOString().replaceAll(/[-:.]/g, '');
349+
const uuidSuffix = randomUUID().slice(0, 8);
350+
351+
return path.join('dist', 'test-out', `${datePrefix}-${uuidSuffix}`);
352+
}

0 commit comments

Comments
 (0)