Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(@angular/build): reverts the test output location to its original…
… and removes unique UUID folders. closes #30713
  • Loading branch information
Bjeaurn committed Sep 11, 2025
commit 602a31f6ab8ad69aec9d90ba0fae6503ba2afed7
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import type { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
import type { Config, ConfigOptions, FilePattern, InlinePluginDef, Server } from 'karma';
import { randomUUID } from 'node:crypto';
import * as fs from 'node:fs/promises';
import type { IncomingMessage, ServerResponse } from 'node:http';
import { createRequire } from 'node:module';
Expand All @@ -24,9 +23,9 @@ import { ApplicationBuilderInternalOptions } from '../application/options';
import { Result, ResultFile, ResultKind } from '../application/results';
import { OutputHashing } from '../application/schema';
import { findTests, getTestEntrypoints } from './find-tests';
import type { KarmaBuilderTransformsOptions } from './index';
import { NormalizedKarmaBuilderOptions, normalizeOptions } from './options';
import { Schema as KarmaBuilderOptions } from './schema';
import type { KarmaBuilderTransformsOptions } from './index';

const localResolve = createRequire(__filename).resolve;
const isWindows = process.platform === 'win32';
Expand Down Expand Up @@ -383,7 +382,8 @@ async function initializeApplication(
): Promise<
[typeof import('karma'), Config & ConfigOptions, BuildOptions, AsyncIterator<Result> | null]
> {
const outputPath = path.join(context.workspaceRoot, 'dist/test-out', randomUUID());
const testOutput = '.angular/cache/test-out'; // Could be extended later to optionally allow for a randomUUID or a custom outputPath.
const outputPath = path.join(context.workspaceRoot, testOutput);
const projectSourceRoot = await getProjectSourceRoot(context);

const [karma, entryPoints] = await Promise.all([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { ResultKind, buildApplicationInternal } from '@angular/build/private';
import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
import { ResultKind, buildApplicationInternal } from '@angular/build/private';
import { execFile as execFileCb } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { promisify } from 'node:util';
Expand All @@ -30,7 +29,10 @@ export default createBuilder(
);

const options = normalizeOptions(schema);
const testOut = path.join(context.workspaceRoot, 'dist/test-out', randomUUID()); // TODO(dgp1130): Hide in temp directory.
// Could be extended later to optionally allow for a randomUUID or a custom outputPath.
const testOutput = '.angular/cache/test-out';

const testOut = path.join(context.workspaceRoot, testOutput);

// Verify Jest installation and get the path to it's binary.
// We need to `node_modules/.bin/jest`, but there is no means to resolve that directly. Fortunately Jest's `package.json` exports the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { Result, ResultKind, buildApplicationInternal } from '@angular/build/private';
import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
import { Result, ResultKind, buildApplicationInternal } from '@angular/build/private';
import type * as WebTestRunner from '@web/test-runner';
import { randomUUID } from 'node:crypto';
import fs from 'node:fs/promises';
import { createRequire } from 'node:module';
import path from 'node:path';
Expand Down Expand Up @@ -43,8 +42,10 @@ export default createBuilder(
}

const options = normalizeOptions(schema);
// Could be extended later to optionally allow for a randomUUID or a custom outputPath.
const testOutput = '.angular/cache/test-out';

const testDir = path.join(ctx.workspaceRoot, 'dist/test-out', randomUUID());
const testDir = path.join(ctx.workspaceRoot, testOutput);

// Parallelize startup work.
const [testFiles] = await Promise.all([
Expand Down