当使用手写笔样式表时,如何在Angular中运行业力测试?

问题描述 投票:0回答:1

我不确定我是否正确构建了问题标题。我想使用ng test为我的Angular 7应用程序运行测试。在我的一个组件中,我使用了一个Stylus样式表:

@Component({
  selector: 'app-root',
  template: ``,
  encapsulation: ViewEncapsulation.None,
  styleUrls: ['../../../../src/app/globalNg1Styles.styl']
})

它在我提供应用程序时工作正常,但是当我尝试运行测试时出现此错误:

ERROR in (...)/src/app/globalNg1Styles.styl
Module build failed (from (...)node_modules/stylus-loader/index.js):
TypeError: Cannot read property 'stylus' of undefined at Object.module.exports ((...)node_modules/stylus-loader/index.js:29:33)
 @ ./src/app/catalog.component.ts 18:21-72
 @ ./src/app/catalog.component.spec.ts
 @ ./src sync \.spec\.ts$
 @ ./src/test.ts

我不知道什么是错的,我怎么能解决这个问题。

javascript angular testing karma-runner stylus
1个回答
0
投票

Stylus-loader版本(2.5.0)有错误。更新到3.0.2解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.