How to configure Karma to include global scss files for an angular-cli project?

后端 未结 5 1434
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 03:33

I cannot configure angular-cli + scss + karma to test my components together. Running ng test the kamra unit tests are only including the components\' own scss

5条回答
  •  余生分开走
    2020-12-19 04:19

    If you use Bootstrap-sass, You should describe karma.conf.js

    preprocessors : {
      './src/test.ts': [ '@angular/cli' ],
      './node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss': [ 'scss' ],
      './src/*.scss': [ 'scss' ]
    },
    

    It is important write order that bootstrap is faster than your file.

提交回复
热议问题