用角度7开玩笑

时间:2020-05-27 06:25:07

标签: jestjs angular7

我在一个有角度的7项目中,试图开玩笑地运行它。我的jest.config.js看起来像这样

module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
};

我正在使用的TypeScript版本是"typescript": "3.6.4"。在其中一个模板中,我有以下代码

@Component({
  selector: 'app-link-lead-tile',
  template: require('./link-lead-tile.component.html')
})

html本身具有类似的内容

<app-tile>
----body---
</app-tile>

但是,当我使用jest运行单元测试时,出现以下错误SyntaxError: Unexpected token '< <app-tile>。好像它试图解析模板中的html。我该如何解决?

除上述内容外,我还收到以下警告 ts-jest[versions] (WARN) Version 3.6.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.8.0 <4.0.0-0)。因此,如果我将typeScript版本升级到最新版本,Angular是否将支持它?

0 个答案:

没有答案