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

Skip to content

Conversation

Bjeaurn
Copy link

@Bjeaurn Bjeaurn commented Sep 11, 2025

Closes #30713

Reverts the test output location to its original and removes unique UUID folders. This reverts it back to .angular/cache/test-out/ and does not append the uuid() to the folder. In the future this could be made optional and perhaps we could introduce a output override for the test options.

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The default (migrated) @angular/build:karma package would output test artifacts into dist/test-out/<uuid>, which would quickly build up folders and make it confusing as test results usually aren't a distributable.

Issue Number: #30713

What is the new behavior?

The default output directory has been reverted to .angular/cache/test-out. Comments have been put in place to prepare the idea to extend it to later allow for custom output directories. It was not clarified if Google itself are depending on this and might require this, so if this is the case let's quickly revisit it and see how we can expand the current solution.

Does this PR introduce a breaking change?

  • Yes
  • No

Although I'm not certain if it "breaks". The new @angular/build:karma seemed to have changed the default output and that was not considered a breaking change it seems? I have marked it as a breaking change for now.

Other information

Copy link

google-cla bot commented Sep 11, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Bjeaurn
Copy link
Author

Bjeaurn commented Sep 11, 2025

Ahh I had the @angular/cli repository for so long, it's still on my old work email... I'll take a look at if I can fix that and repush the commit, or create a new one...

@jkrems
Copy link
Contributor

jkrems commented Sep 11, 2025

You should be able to use --reset-author on git amend to use your new author info IIRC.

@Bjeaurn Bjeaurn force-pushed the fix-#30713-build-karma-test-out-artifacts branch from 68f622a to ae99687 Compare September 11, 2025 16:59
@jkrems jkrems requested a review from clydin September 11, 2025 17:06
@Bjeaurn Bjeaurn force-pushed the fix-#30713-build-karma-test-out-artifacts branch from ae99687 to 602a31f Compare September 11, 2025 17:16
@clydin
Copy link
Member

clydin commented Sep 11, 2025

The test output files were previously kept in memory when using Karma with Webpack.
As of v21, the Vitest runner will use in-memory files via the unit-test system.

When using the test runners that do still write to disk, the unique identifiers are critical for concurrent test runs.
For v20, an option to address the linked issue may be to implement automatic cleanup similar to what was previously in the Vitest runner: b554bd7

@Bjeaurn
Copy link
Author

Bjeaurn commented Sep 11, 2025

The test output files were previously kept in memory when using Karma with Webpack. As of v21, the Vitest runner will use in-memory files via the unit-test system.

When using the test runners that do still write to disk, the unique identifiers are critical for concurrent test runs. For v20, an option to address the linked issue may be to implement automatic cleanup similar to what was previously in the Vitest runner: b554bd7

Good point! I think for the main one (karma), this was already in there (but did very little in the previous iteration of course, UUIDs are supposed to be unique) over here:

fs.rm(outputPath, { recursive: true, force: true }),

For web-test-runner:

fs.rm(testDir, { recursive: true, force: true }),

It seems that for Jest this is either sorted differently or is currently not being handled, so that might an improvement to make?

I can't find a good place within the setup for Karma or Jest as they don't seem to have the same setup and organization with an executor.ts as an entrypoint that can set up any SIGINT handlers. Any suggestions or ideas for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@angular/build:karma builder leaves test-out artifacts in the dist directory
3 participants