From 305ae03e02a5a4782a481ebb5ed92a39c6404313 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Mon, 16 Nov 2026 10:48:43 -0500 Subject: [PATCH 1/2] fix(@angular/cli): preserve all arguments following -- Previously, `createNormalizeOptionsMiddleware` treated `--` (populated by yargs when `'populate--': true` is enabled) like any non-array option, collapsing its array to the last element and logging a spurious warning. In addition, `CommandModule.handler` only stripped `_` and `$0` from parsed arguments, allowing `--` to leak into `camelCasedOptions` and be forwarded to commands as an unexpected option. Exclude `--` from option normalization, extract `--` in `CommandModule.handler` into `passthroughArgs`, and reject non-empty `--` arguments with a `CommandModuleError` for commands that do not opt into `acceptsPassthroughArgs`. --- .../cli/src/command-builder/command-module.ts | 17 ++- .../command-builder/command-module_spec.ts | 113 ++++++++++++++++++ .../utilities/normalize-options-middleware.ts | 2 +- .../normalize-options-middleware_spec.ts | 65 ++++++++++ 4 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 packages/angular/cli/src/command-builder/command-module_spec.ts create mode 100644 packages/angular/cli/src/command-builder/utilities/normalize-options-middleware_spec.ts diff --git a/packages/angular/cli/src/command-builder/command-module.ts b/packages/angular/cli/src/command-builder/command-module.ts index ec92bc452d5b..d383d4e9317c 100644 --- a/packages/angular/cli/src/command-builder/command-module.ts +++ b/packages/angular/cli/src/command-builder/command-module.ts @@ -54,6 +54,8 @@ export abstract class CommandModule implements CommandModuleI readonly longDescription?: string; readonly longDescriptionRelativePath?: string; protected readonly shouldReportAnalytics: boolean = true; + protected readonly acceptsPassthroughArgs: boolean = false; + protected passthroughArgs: readonly string[] | undefined; readonly scope: CommandScope = CommandScope.Both; private readonly optionsWithAnalytics = new Map< @@ -96,9 +98,21 @@ export abstract class CommandModule implements CommandModuleI abstract run(options: Options & OtherOptions): Promise | number | void; async handler(args: ArgumentsCamelCase & OtherOptions): Promise { - const { _, $0, ...options } = args; + const { _, $0, '--': passthroughArgs, ...options } = args; const { logger } = this.context; + if (Array.isArray(passthroughArgs) && passthroughArgs.length > 0) { + if (!this.acceptsPassthroughArgs) { + throw new CommandModuleError( + `Arguments following "--" are not supported by the "${this.commandName}" command.`, + ); + } + + this.passthroughArgs = passthroughArgs.map(String); + } else { + this.passthroughArgs = undefined; + } + // Camelize options as yargs will return the object in kebab-case when camel casing is disabled. const camelCasedOptions: Record = {}; for (const [key, value] of Object.entries(options)) { @@ -139,6 +153,7 @@ export abstract class CommandModule implements CommandModuleI throw e; } } finally { + this.passthroughArgs = undefined; await stopPeriodicFlushes?.(); if (typeof exitCode === 'number' && exitCode > 0) { diff --git a/packages/angular/cli/src/command-builder/command-module_spec.ts b/packages/angular/cli/src/command-builder/command-module_spec.ts new file mode 100644 index 000000000000..20632d1d5551 --- /dev/null +++ b/packages/angular/cli/src/command-builder/command-module_spec.ts @@ -0,0 +1,113 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +import { logging } from '@angular-devkit/core'; +import type { ArgumentsCamelCase, Argv } from 'yargs'; +import { CommandModule, CommandModuleError, Options, OtherOptions } from './command-module'; +import { CommandContext } from './definitions'; + +class UnsupportedPassthroughCommand extends CommandModule { + override readonly command = 'test-cmd'; + override readonly describe = 'Test command'; + override readonly shouldReportAnalytics = false; + receivedOptions: (Options<{}> & OtherOptions) | undefined; + + override builder(argv: Argv): Argv { + return argv; + } + + override run(options: Options<{}> & OtherOptions): number { + this.receivedOptions = options; + + return 0; + } +} + +class SupportedPassthroughCommand extends CommandModule { + override readonly command = 'pass-cmd'; + override readonly describe = 'Command supporting passthrough'; + override readonly shouldReportAnalytics = false; + protected override readonly acceptsPassthroughArgs = true; + receivedOptions: (Options<{}> & OtherOptions) | undefined; + receivedPassthroughArgs: readonly string[] | undefined; + + override builder(argv: Argv): Argv { + return argv; + } + + override run(options: Options<{}> & OtherOptions): number { + this.receivedOptions = options; + this.receivedPassthroughArgs = this.passthroughArgs; + + return 0; + } +} + +function createCommandContext(): CommandContext { + return { + currentDirectory: '/workspace', + root: '/workspace', + logger: new logging.NullLogger(), + args: { + positional: [], + options: { + help: false, + jsonHelp: false, + getYargsCompletions: false, + }, + }, + } as unknown as CommandContext; +} + +describe('CommandModule passthrough arguments', () => { + it('rejects arguments after "--" when command does not support passthrough', async () => { + const command = new UnsupportedPassthroughCommand(createCommandContext()); + const args = { + _: ['test-cmd'], + $0: 'ng', + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await expectAsync(command.handler(args)).toBeRejectedWithError( + CommandModuleError, + 'Arguments following "--" are not supported by the "test-cmd" command.', + ); + expect(command.receivedOptions).toBeUndefined(); + }); + + it('allows empty "--" array on commands that do not support passthrough', async () => { + const command = new UnsupportedPassthroughCommand(createCommandContext()); + const args = { + _: ['test-cmd'], + $0: 'ng', + '--': [], + watch: false, + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await command.handler(args); + + expect(command.receivedOptions).toEqual({ watch: false }); + expect('--' in (command.receivedOptions ?? {})).toBeFalse(); + }); + + it('forwards "--" arguments via passthroughArgs and omits "--" from options when supported', async () => { + const command = new SupportedPassthroughCommand(createCommandContext()); + const args = { + _: ['pass-cmd'], + $0: 'ng', + '--': ['--update', '--reporter=verbose'], + watch: false, + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await command.handler(args); + + expect(command.receivedPassthroughArgs).toEqual(['--update', '--reporter=verbose']); + expect(command.receivedOptions).toEqual({ watch: false }); + expect('--' in (command.receivedOptions ?? {})).toBeFalse(); + }); +}); diff --git a/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware.ts b/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware.ts index 792f09f7a97b..b10859035e3f 100644 --- a/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware.ts +++ b/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware.ts @@ -26,7 +26,7 @@ export function createNormalizeOptionsMiddleware(localeYargs: Argv): (args: Argu const arrayOptions = new Set(array); for (const [key, value] of Object.entries(args)) { - if (key !== '_' && Array.isArray(value) && !arrayOptions.has(key)) { + if (key !== '_' && key !== '--' && Array.isArray(value) && !arrayOptions.has(key)) { const newValue = value.pop(); // eslint-disable-next-line no-console console.warn( diff --git a/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware_spec.ts b/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware_spec.ts new file mode 100644 index 000000000000..913751c2d092 --- /dev/null +++ b/packages/angular/cli/src/command-builder/utilities/normalize-options-middleware_spec.ts @@ -0,0 +1,65 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +import type { Arguments, Argv } from 'yargs'; +import { createNormalizeOptionsMiddleware } from './normalize-options-middleware'; + +describe('createNormalizeOptionsMiddleware', () => { + function createMockYargs(arrayOptions: string[] = []): Argv { + return { + getOptions: () => ({ array: arrayOptions }), + } as unknown as Argv; + } + + it('preserves "--" as an array without warning', () => { + const warnSpy = spyOn(console, 'warn'); + const middleware = createNormalizeOptionsMiddleware(createMockYargs()); + const args: Arguments = { + _: ['test'], + $0: 'ng', + '--': ['--update', '--reporter=verbose'], + }; + + middleware(args); + + expect(args['--']).toEqual(['--update', '--reporter=verbose']); + expect(warnSpy).not.toHaveBeenCalled(); + }); + + it('collapses non-array duplicate options and warns', () => { + const warnSpy = spyOn(console, 'warn'); + const middleware = createNormalizeOptionsMiddleware(createMockYargs()); + const args: Arguments = { + _: [], + $0: 'ng', + configuration: ['development', 'production'], + }; + + middleware(args); + + expect(args['configuration']).toBe('production'); + expect(warnSpy).toHaveBeenCalledWith( + "Option 'configuration' has been specified multiple times. The value 'production' will be used.", + ); + }); + + it('preserves declared array options without warning', () => { + const warnSpy = spyOn(console, 'warn'); + const middleware = createNormalizeOptionsMiddleware(createMockYargs(['include'])); + const args: Arguments = { + _: [], + $0: 'ng', + include: ['a.spec.ts', 'b.spec.ts'], + }; + + middleware(args); + + expect(args['include']).toEqual(['a.spec.ts', 'b.spec.ts']); + expect(warnSpy).not.toHaveBeenCalled(); + }); +}); From 64aff7ac7e90f07a991b903733e78cb8a10e6b8b Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Mon, 16 Nov 2026 10:52:24 -0500 Subject: [PATCH 2/2] feat(@angular/cli): forward arguments after -- to supporting builders Allow architect-backed commands (`ng test`, `ng run`, etc.) to forward arguments after `--` to builders that explicitly opt in via the `"x-passthrough": true` schema keyword on an array option. This adds a `passthrough` flag to `Option` parsed from `"x-passthrough"` in `parseJsonSchemaToOptions`, enables `acceptsPassthroughArgs` on `ArchitectBaseCommandModule`, and updates `runSingleTarget` to route `passthroughArgs` to the target builder's `x-passthrough` option (appending after any explicit option values) or throw a `CommandModuleError` when the builder does not declare one. The `@angular/build` `unit-test` builder marks `runnerArgs` with `"x-passthrough": true` so `ng test -- ` forwards arguments to Vitest. The `ng test` help description and Vitest snapshot e2e test are updated accordingly. --- .../build/src/builders/unit-test/schema.json | 3 +- .../architect-base-command-module.ts | 38 ++- .../architect-base-command-module_spec.ts | 228 ++++++++++++++++++ .../command-builder/utilities/json-schema.ts | 6 + .../utilities/json-schema_spec.ts | 27 +++ .../cli/src/commands/test/long-description.md | 2 + tests/e2e/tests/vitest/snapshot.ts | 23 ++ 7 files changed, 325 insertions(+), 2 deletions(-) create mode 100644 packages/angular/cli/src/command-builder/architect-base-command-module_spec.ts diff --git a/packages/angular/build/src/builders/unit-test/schema.json b/packages/angular/build/src/builders/unit-test/schema.json index d004e7024831..c08df9a38ecb 100644 --- a/packages/angular/build/src/builders/unit-test/schema.json +++ b/packages/angular/build/src/builders/unit-test/schema.json @@ -29,7 +29,8 @@ "description": "Additional command line arguments to provide to the test runner. Each argument must be a separate value, for example `--runner-args=--update --runner-args=--bail=1`. This option is only available for the Vitest runner and only a subset of the Vitest command line options is supported. Options that have an equivalent builder option, such as `--reporter` or `--coverage`, must be configured with the builder option.", "items": { "type": "string" - } + }, + "x-passthrough": true }, "browsers": { "description": "Specifies the browsers to use for test execution. When not specified, the Vitest runner runs tests in a Node.js environment using `happy-dom` if it is installed, otherwise `jsdom`, and the Karma runner uses the browsers of its configuration. Browser names ending with `Headless` enable headless mode (e.g., `ChromiumHeadless` for Vitest with the Playwright provider, or `ChromeHeadless` for Karma).", diff --git a/packages/angular/cli/src/command-builder/architect-base-command-module.ts b/packages/angular/cli/src/command-builder/architect-base-command-module.ts index e30039f67fec..e0481c53049b 100644 --- a/packages/angular/cli/src/command-builder/architect-base-command-module.ts +++ b/packages/angular/cli/src/command-builder/architect-base-command-module.ts @@ -37,6 +37,7 @@ export abstract class ArchitectBaseCommandModule implements CommandModuleImplementation { override scope = CommandScope.In; + protected override readonly acceptsPassthroughArgs = true; protected readonly missingTargetChoices: MissingTargetChoice[] | undefined; protected async runSingleTarget(target: Target, options: OtherOptions): Promise { @@ -51,12 +52,47 @@ export abstract class ArchitectBaseCommandModule return this.onMissingTarget(e.message); } + let targetOptions = options; + if (this.passthroughArgs?.length) { + const builderOptions = await this.getOptionsForBuilder(builderName); + const passthroughOptions = builderOptions.filter((option) => option.passthrough); + if (passthroughOptions.length > 1) { + throw new CommandModuleError( + `The '${builderName}' builder schema defines multiple options with 'x-passthrough'.`, + ); + } + + const [passthroughOption] = passthroughOptions; + if (!passthroughOption) { + throw new CommandModuleError( + `The '${builderName}' builder does not accept arguments after '--'.`, + ); + } + + if (passthroughOption.type !== 'array') { + throw new CommandModuleError( + `The '${builderName}' builder option '${passthroughOption.name}' has 'x-passthrough' enabled but is not an array.`, + ); + } + + const existing = options[passthroughOption.name]; + const existingArgs = Array.isArray(existing) + ? existing + : existing !== undefined && existing !== null + ? [existing] + : []; + targetOptions = { + ...options, + [passthroughOption.name]: [...existingArgs, ...this.passthroughArgs], + }; + } + const isAngularBuild = builderName.startsWith('@angular/build:'); const { logger } = this.context; const run = await this.getArchitect(isAngularBuild).scheduleTarget( target, - options as json.JsonObject, + targetOptions as json.JsonObject, { logger, }, diff --git a/packages/angular/cli/src/command-builder/architect-base-command-module_spec.ts b/packages/angular/cli/src/command-builder/architect-base-command-module_spec.ts new file mode 100644 index 000000000000..c0487c83457d --- /dev/null +++ b/packages/angular/cli/src/command-builder/architect-base-command-module_spec.ts @@ -0,0 +1,228 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +import { Target } from '@angular-devkit/architect'; +import { logging } from '@angular-devkit/core'; +import type { ArgumentsCamelCase, Argv } from 'yargs'; +import { ArchitectBaseCommandModule } from './architect-base-command-module'; +import { CommandModuleError, Options, OtherOptions } from './command-module'; +import { CommandContext } from './definitions'; +import { Option } from './utilities/json-schema'; + +class TestArchitectCommand extends ArchitectBaseCommandModule<{}> { + override readonly command = 'test'; + override readonly describe = 'Test architect command'; + override readonly shouldReportAnalytics = false; + + builderOptions: Option[] = []; + builderName = '@angular/build:unit-test'; + scheduledOptions: Record | undefined; + + override builder(argv: Argv): Argv { + return argv; + } + + override async run(options: Options<{}> & OtherOptions): Promise { + return this.runSingleTarget({ project: 'app', target: 'test' }, options); + } + + protected override getArchitectHost() { + return { + getBuilderNameForTarget: async (_target: Target) => this.builderName, + } as never; + } + + protected override async getOptionsForBuilder(_builderConf: string): Promise { + return this.builderOptions; + } + + protected override getArchitect() { + return { + scheduleTarget: async (_target: Target, options: Record) => { + this.scheduledOptions = options; + + return { + lastOutput: Promise.resolve({ success: true }), + stop: async () => {}, + }; + }, + } as never; + } +} + +function createCommandContext(): CommandContext { + return { + currentDirectory: '/workspace', + root: '/workspace', + logger: new logging.NullLogger(), + args: { + positional: [], + options: { + help: false, + jsonHelp: false, + getYargsCompletions: false, + }, + }, + } as unknown as CommandContext; +} + +describe('ArchitectBaseCommandModule passthrough arguments', () => { + it('forwards arguments after "--" to the x-passthrough option', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderOptions = [ + { + name: 'runnerArgs', + description: 'Runner args', + type: 'array', + passthrough: true, + }, + ]; + + const args = { + _: ['test'], + $0: 'ng', + '--': ['--update', '--bail=1'], + watch: false, + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await command.handler(args); + + expect(command.scheduledOptions).toEqual({ + watch: false, + runnerArgs: ['--update', '--bail=1'], + }); + }); + + it('concatenates explicit option values before "--" passthrough arguments', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderOptions = [ + { + name: 'runnerArgs', + description: 'Runner args', + type: 'array', + passthrough: true, + }, + ]; + + const args = { + _: ['test'], + $0: 'ng', + 'runner-args': ['--shard=1/2'], + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await command.handler(args); + + expect(command.scheduledOptions).toEqual({ + runnerArgs: ['--shard=1/2', '--update'], + }); + }); + + it('rejects "--" arguments when the target builder has no x-passthrough option', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderName = '@angular/build:application'; + command.builderOptions = [ + { + name: 'watch', + description: 'Watch', + type: 'boolean', + }, + ]; + + const args = { + _: ['build'], + $0: 'ng', + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await expectAsync(command.handler(args)).toBeRejectedWithError( + CommandModuleError, + "The '@angular/build:application' builder does not accept arguments after '--'.", + ); + expect(command.scheduledOptions).toBeUndefined(); + }); + + it('rejects "--" arguments when the target builder defines multiple x-passthrough options', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderOptions = [ + { + name: 'runnerArgs', + description: 'Runner args', + type: 'array', + passthrough: true, + }, + { + name: 'extraArgs', + description: 'Extra args', + type: 'array', + passthrough: true, + }, + ]; + + const args = { + _: ['test'], + $0: 'ng', + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await expectAsync(command.handler(args)).toBeRejectedWithError( + CommandModuleError, + "The '@angular/build:unit-test' builder schema defines multiple options with 'x-passthrough'.", + ); + expect(command.scheduledOptions).toBeUndefined(); + }); + + it('rejects "--" arguments when the x-passthrough option is not an array', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderOptions = [ + { + name: 'runnerArg', + description: 'Runner arg', + type: 'string', + passthrough: true, + }, + ]; + + const args = { + _: ['test'], + $0: 'ng', + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await expectAsync(command.handler(args)).toBeRejectedWithError( + CommandModuleError, + "The '@angular/build:unit-test' builder option 'runnerArg' has 'x-passthrough' enabled but is not an array.", + ); + expect(command.scheduledOptions).toBeUndefined(); + }); + + it('wraps a scalar existing option value before "--" passthrough arguments', async () => { + const command = new TestArchitectCommand(createCommandContext()); + command.builderOptions = [ + { + name: 'runnerArgs', + description: 'Runner args', + type: 'array', + passthrough: true, + }, + ]; + + const args = { + _: ['run'], + $0: 'ng', + 'runner-args': '--shard=1/2', + '--': ['--update'], + } as unknown as ArgumentsCamelCase<{}> & OtherOptions; + + await command.handler(args); + + expect(command.scheduledOptions).toEqual({ + runnerArgs: ['--shard=1/2', '--update'], + }); + }); +}); diff --git a/packages/angular/cli/src/command-builder/utilities/json-schema.ts b/packages/angular/cli/src/command-builder/utilities/json-schema.ts index 95b51bee3669..f99c8ab0f41d 100644 --- a/packages/angular/cli/src/command-builder/utilities/json-schema.ts +++ b/packages/angular/cli/src/command-builder/utilities/json-schema.ts @@ -60,6 +60,11 @@ export interface Option extends YargsOptions { * Allowed boolean values when `boolean` is one of the supported types. */ booleanValues?: ReadonlySet; + + /** + * Whether arguments after `--` should be forwarded to this option. + */ + passthrough?: boolean; } /** @@ -530,6 +535,7 @@ export async function parseJsonSchemaToOptions( positional, types, booleanValues: types.includes('boolean') ? getAllowedBooleanValues(current) : undefined, + passthrough: current['x-passthrough'] === true || undefined, ...(type === 'object' ? { type: 'array', diff --git a/packages/angular/cli/src/command-builder/utilities/json-schema_spec.ts b/packages/angular/cli/src/command-builder/utilities/json-schema_spec.ts index 6441662d48d0..d0899869ff31 100644 --- a/packages/angular/cli/src/command-builder/utilities/json-schema_spec.ts +++ b/packages/angular/cli/src/command-builder/utilities/json-schema_spec.ts @@ -580,4 +580,31 @@ describe('parseJsonSchemaToOptions', () => { ]); }); }); + + describe('with x-passthrough', () => { + it('sets passthrough to true when x-passthrough is true and undefined otherwise', async () => { + const jsonSchema = { + '$id': 'FakeSchema', + 'title': 'Fake Schema', + 'type': 'object', + 'properties': { + 'runnerArgs': { + 'type': 'array', + 'items': { 'type': 'string' }, + 'x-passthrough': true, + }, + 'other': { + 'type': 'string', + }, + }, + }; + const registry = new schema.CoreSchemaRegistry(); + const options = await parseJsonSchemaToOptions(registry, jsonSchema); + + expect(options.find((opt) => opt.name === 'runnerArgs')).toEqual( + jasmine.objectContaining({ name: 'runnerArgs', passthrough: true }), + ); + expect(options.find((opt) => opt.name === 'other')?.passthrough).toBeUndefined(); + }); + }); }); diff --git a/packages/angular/cli/src/commands/test/long-description.md b/packages/angular/cli/src/commands/test/long-description.md index 25086c174e15..251b7efacb5f 100644 --- a/packages/angular/cli/src/commands/test/long-description.md +++ b/packages/angular/cli/src/commands/test/long-description.md @@ -1,2 +1,4 @@ Takes the name of the project, as specified in the `projects` section of the `angular.json` workspace configuration file. When a project name is not supplied, it will execute for all projects. + +Arguments following `--` are forwarded directly to the test runner when supported by the configured builder (for example, `ng test -- --update`). diff --git a/tests/e2e/tests/vitest/snapshot.ts b/tests/e2e/tests/vitest/snapshot.ts index cb1c76ad6fd6..0334ad4906ce 100644 --- a/tests/e2e/tests/vitest/snapshot.ts +++ b/tests/e2e/tests/vitest/snapshot.ts @@ -124,4 +124,27 @@ describe('App', () => { /Snapshots\s+\d+ (written|updated|failed|obsolete)/, 'Snapshots were unexpectedly modified after being updated.', ); + + // Sixth run: update snapshots via `-- --update` passthrough + await replaceInFile('src/app/app.ts', 'test-project (updated)', 'test-project (passthrough)'); + const { stdout: passthroughUpdateStdout } = await ng('test', '--', '--update'); + assert.match( + stripVTControlCharacters(passthroughUpdateStdout), + /Snapshots\s+2 updated/, + 'Snapshots were not updated when `-- --update` was passed.', + ); + + const passthroughSpecContent = await readFile('src/app/app.spec.ts'); + assert.match( + passthroughSpecContent, + /toMatchInlineSnapshot\(`"test-project \(passthrough\)"`\)/, + 'Inline snapshot was not updated via `-- --update`.', + ); + + const passthroughSnapshotContent = await readFile('src/app/__snapshots__/app.spec.ts.snap'); + assert.match( + passthroughSnapshotContent, + /exports\[`App > should match file snapshot 1`\] = `"test-project \(passthrough\)"`;/, + 'File snapshot was not updated via `-- --update`.', + ); }