Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles CSS files not available in unit tests #21054

Closed
1 of 15 tasks
gkalpak opened this issue Jun 5, 2021 · 1 comment · Fixed by #21065
Closed
1 of 15 tasks

Styles CSS files not available in unit tests #21054

gkalpak opened this issue Jun 5, 2021 · 1 comment · Fixed by #21065

Comments

@gkalpak
Copy link
Member

gkalpak commented Jun 5, 2021

🐞 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
@ngbot ngbot bot modified the milestone: Backlog Jun 7, 2021
@alan-agius4 alan-agius4 self-assigned this Jun 7, 2021
alan-agius4 added a commit that referenced this issue Jun 9, 2021
… unit tests

With this change we force styles to be extracted in css files during unit tests.

Closes #21054
alan-agius4 added a commit that referenced this issue Jun 9, 2021
… unit tests

With this change we force styles to be extracted in css files during unit tests.

Closes #21054

(cherry picked from commit dc5a585)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants