Skip to content

Styles CSS files not available in unit tests #21054

Closed
@gkalpak

Description

@gkalpak

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Not sure.

Description

In angular.io, we have the following build > styles:

{
  "inject": false,
  "input": "src/styles/custom-themes/dark-theme.scss",
  "bundleName": "dark-theme"
},
{
  "inject": false,
  "input": "src/styles/custom-themes/light-theme.scss",
  "bundleName": "light-theme"
}

However, adding the same styles in test > styles (see PR 42259) does not make them available during unit tests, resulting in many warnings (which mess up the output):

WARN [web-server]: 404: /_karma_webpack_/light-theme.css

See the problem in action on CI.

🔬 Minimal Reproduction

  • Check out PR #42259.
  • cd aio && yarn && yarn test

🔥 Exception or Error

WARN [web-server]: 404: /_karma_webpack_/light-theme.css
...
WARN [web-server]: 404: /_karma_webpack_/dark-theme.css

🌍 Your Environment

Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: yarn 1.22.10
OS: win32 x64

Angular: 12.0.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, material, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.2
@angular-devkit/build-angular   12.0.2
@angular-devkit/core            12.0.2
@angular-devkit/schematics      12.0.2
@schematics/angular             12.0.2
rxjs                            6.6.7
typescript                      4.3.2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions