Skip to content

Running ng test throws error for different builders with no overrides #12344

Closed
@FrozenPandaz

Description

@FrozenPandaz

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [x] test
- [x] e2e
- [ ] generate
- [ ] add
- [ ] update
- [x] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Jasons-MacBook-Pro:oldnxws jason$ ng -v

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.2.3
Node: 8.10.0
OS: darwin x64
Angular: 6.1.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.3
@angular-devkit/build-angular     0.8.3
@angular-devkit/build-optimizer   0.8.3
@angular-devkit/build-webpack     0.8.3
@angular-devkit/core              0.8.3
@angular-devkit/schematics        0.8.3
@angular/cli                      6.2.3
@ngtools/webpack                  6.2.3
@schematics/angular               0.8.3
@schematics/update                0.8.3
rxjs                              6.3.2
typescript                        2.9.2
webpack                           4.19.1

Repro steps

A workspace with projects with different builders will not be able to use ng test (no overrides).

The log given by the failure

The following Error is thrown:

Jasons-MacBook-Pro:oldnxws jason$ yarn test
yarn run v1.9.4
$ ng test
Architect commands with command line overrides cannot target different builders. The 'test' target would run on projectsapp1,app2 which have the following builders:  @angular-devkit/build-angular:karma @nrwl/builders:jest
Error: Architect commands with command line overrides cannot target different builders. The 'test' target would run on projects app1,app2 which have the following builders:  @angular-devkit/build-angular:karma @nrwl/builders:jest
    at TestCommand.validate (/Users/jason/projects/temp/oldnxws/node_modules/@angular/cli/models/architect-command.js:95:27)
    at Object.<anonymous> (/Users/jason/projects/temp/oldnxws/node_modules/@angular/cli/models/command-runner.js:175:39)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jason/projects/temp/oldnxws/node_modules/@angular/cli/models/command-runner.js:11:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

Desired functionality

I understand that with different builders, sending overrides to all of them will be virtually impossible to manage. However, without overrides should not be an error (ng test with no overrides) since the configuration within angular.json will be specific to the builder for each target.

Mention any other details that might be useful

This would be extremely useful for something I'm working on for Nx which is to build backends inside an angular cli workspace. If ng test (no overrides) were to test all projects regardless of which builder they were using, just that they have a test target.

Also might be useful

Also, if there could be a flag that allows overrides to be sent, it could enable some usage if two builders were to share similar options.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions