简体   繁体   English

业力将应用程序样式放在记者面前

[英]Karma puts app styles in front of reporter

I'm trying to do karma test with angular-cli and the app styles I have keep getting in front of the reporter. 我正在尝试使用angular-cli和我一直在记者面前看到的应用程序样式进行业力测试。 It's a bit frustrating and I want to be remove the app styles completely. 这有点令人沮丧,我想完全删除应用程序样式。

在此处输入图片说明

My current fix is: 我当前的解决方法是:

app.component.scss app.component.scss

:host /deep/ {
  visibility: hidden;
  pointer-events: none;
}

I don't want to have to visit this sass file and comment/uncomment out these lines of code every time I do npm run test . 我不需要每次执行npm run test时都必须访问此sass文件并注释掉这些代码行。

How can I remove the app styles so I can see the actual reporter? 如何删除应用程序样式,以便可以看到实际的记者?

A related question I also posted: Question About Dark Theme 我还发布了一个相关的问题:关于黑暗主题的问题

My answer to your other question should help: merely include your hide CSS in karma.css as described there. 我的回答对您的其他问题应该有所帮助:只在您的隐藏CSS karma.css与那里描述。 Notably you won't have to edit the original Karma HTML files for this particular functionality. 值得注意的是,您无需为此功能而编辑原始Karma HTML文件。

An extract from that answer: 该答案的摘录:

Karma allows you to add files to its config, which allows insertion of CSS or JS. 业力允许您将文件添加到其配置,该配置允许插入CSS或JS。 Source . 来源

 // list of files / patterns to load in the browser files: [ 'karma.css' ] 

These are relative to the config, which would be the root of your project if you use the default setup for Angular.io . 这些是相对于配置的,如果使用Angular.io的默认设置,则配置将是项目的根。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM