【发布时间】:2019-10-17 14:03:13
【问题描述】:
我有一个用于 typescript 文件的 ejs 模板,我需要使用 #jest 编写一个单元测试,以使用 #typescript-eslint 验证我的模板的渲染 typescript 输出(不是 tslint,因为它很快就会被弃用:https://medium.com/palantir/tslint-in-2019-1a144c2317a9 )
因此,我需要在我的规范文件中使用 typescript-eslint 模块,并通过以下代码运行我渲染的 ejs 的验证:
it('should be valid typescript file', () => {
return ejs.renderFile('my-ejs-template.ts.ejs', {}).then(async (view) => {
const eslint = require('@typescript-eslint/eslint-plugin');
// what is next ???
});
});
任何帮助将不胜感激
【问题讨论】:
标签: typescript jestjs ejs typescript-eslint