Skip to content

Style path error in test configuration logs an obscure error message #24416

Closed
@cexbrayat

Description

@cexbrayat

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

In a new project, replace styles.css by a file that does not exists:

- "styles": ["src/styles.css"],
+ "styles": ["src/error.css"],

then run ng test

Minimal Reproduction

https://stackblitz.com/edit/node-8w6owh?file=repro-style-error/angular.json

Run ng test

Exception or Error

❯ ng test
⠙ Generating browser application bundles (phase: setup)...AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Compilation cannot be undefined.
    at get (https://node8w6owh-vb42.w-corp.staticblitz.com/blitz.8cf5a3c77f45c942df800a39619ec49fff7e5814.js:6:292488)
    at AssertionError (https://node8w6owh-vb42.w-corp.staticblitz.com/blitz.8cf5a3c77f45c942df800a39619ec49fff7e5814.js:6:944835)
    at innerOk (https://node8w6owh-vb42.w-corp.staticblitz.com/blitz.8cf5a3c77f45c942df800a39619ec49fff7e5814.js:6:827492)
    at ok (https://node8w6owh-vb42.w-corp.staticblitz.com/blitz.8cf5a3c77f45c942df800a39619ec49fff7e5814.js:6:827616)
    at apply/webpackOptions.entry@file:///home/projects/node-8w6owh/repro-style-error/node_modules/ (angular-devkit/build-angular/src/webpack/plugins/styles-webpack-plugin.js:58:46)
    at <anonymous> (<anonymous>) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}

Your Environment

Angular CLI: 15.0.3
Node: 16.14.2
Package Manager: npm 7.17.0
OS: linux x64

Angular: 15.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.3
@angular-devkit/build-angular   15.0.3
@angular-devkit/core            15.0.3
@angular-devkit/schematics      15.0.3
@schematics/angular             15.0.3
rxjs                            7.5.7
typescript                      4.8.4

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions