Skip to content

passWithNoTests flag does not work in executer @nx/angular:unit-test #34241

@danielritter

Description

@danielritter

Current Behavior

At the moment the passWithNoTests flag does not work in executer @nx/angular:unit-test. So packages without tests fail with:

01:54:14   An exception occurred while getting runner-specific build options:
01:54:14   Error: No tests found matching the following patterns:
01:54:14   - Included: **/*.spec.ts, **/*.test.ts
01:54:14   
01:54:14   Please check the 'test' target configuration in your project's 'angular.json' file.
01:54:14       at getVitestBuildOptions (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/@angular/build/src/builders/unit-test/runners/vitest/build-options.js:78:15)
01:54:14       at async execute (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/@angular/build/src/builders/unit-test/builder.js:306:13)
01:54:14       at async unitTestExecutor (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/@nx/angular/src/executors/unit-test/unit-test.impl.js:59:12)
01:54:14       at async getLastValueFromAsyncIterableIterator (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/nx/src/utils/async-iterator.js:15:19)
01:54:14       at async iteratorToProcessStatusCode (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/nx/src/command-line/run/run.js:39:25)
01:54:14       at async handleErrors (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/nx/src/utils/handle-errors.js:8:24)
01:54:14       at async process.<anonymous> (/srv/teamcity/agents/agent-3/work/85ceec441cda0047/node_modules/nx/bin/run-executor.js:59:28)

Expected Behavior

Something like that should be possible as in the jest executer:

		"test": {
			"executor": "@nx/angular:unit-test",
			"options": {
				"passWithNoTests": true
			}
		},

As seen in the documentation of vitest the option is also available: https://vitest.dev/guide/cli.html#options

GitHub Repo

No response

Steps to Reproduce

  1. Create new package without tests (executer: @nx/angular:unit-test)
  2. Run test of package

Nx Report

Node           : 24.11.1
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 11.6.2
daemon         : Available

nx (global)            : 22.4.1
nx                     : 22.4.1
@nx/js                 : 22.4.1
@nx/eslint             : 22.4.1
@nx/workspace          : 22.4.1
@nx/angular            : 22.4.1
@nx/jest               : 22.4.1
@nx/cypress            : 22.4.1
@nx/devkit             : 22.4.1
@nx/eslint-plugin      : 22.4.1
@nx/module-federation  : 22.4.1
@nx/nest               : 22.4.1
@nx/node               : 22.4.1
@nx/plugin             : 22.4.1
@nx/rspack             : 22.4.1
@nx/storybook          : 22.4.1
@nx/web                : 22.4.1
@nx/webpack            : 22.4.1
@nx/docker             : 22.4.1
typescript             : 5.9.3
---------------------------------------
Registered Plugins:
@development/targets
@development/schematics
@nx/webpack/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc   : 1.1.32
@ng-doc/builder      : 21.0.0
@ngrx/effects        : 21.0.0
@ngrx/entity         : 21.0.0
@ngrx/operators      : 21.0.0
@ngrx/router-store   : 21.0.0
@ngrx/schematics     : 21.0.0
@ngrx/signals        : 21.0.0
@ngrx/store          : 21.0.0
@ngrx/store-devtools : 21.0.0
@storybook/angular   : 10.1.10
angular-eslint       : 21.0.1
---------------------------------------
Local workspace plugins:
@development/schematics
---------------------------------------
Cache Usage: 27.09 MB / 96.70 GB

Failure Logs

Error when passWithNoTests option is applied in executer @nx/angular:unit-test.

  NX   'passWithNoTests' is not found in schema

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions