我想在赛普拉斯的前端进行代码覆盖。目前,柏树推荐伊斯坦布尔进行报道。不幸的是,我不能在下面的堆栈中使用它:
因为:-我找不到让ts-loader使用istanbul的方法,因为istanbul-intementer-loader在后台使用babel -babel-loader不像打字稿那样支持装饰器,这会破坏vue-proporty-decorator。在没有wue-property-decorator的打字稿中使用vue并不是那么整洁...
这是一些有用的链接:
这是仓库和快速概述:
git clone https://github.com/akoidan/vue-webpack-typescript && cd vue-webpack-typescript
yarn install
yarn run build
yarn run e2e
您也可以在上面的仓库中查看babel分支,以查看使用babel而不是ts-loader的示例
这是使用ts-loader进行安装的示例:
package.json:
{
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"all": true
}
}
cypress / iintegration / sample_spec.ts:
describe('My first Test', function() {
it('Does not much', function() {
cy.visit('/');
cy.contains('Filtered Users');
})
});
cypress / plugins / index.js:
module.exports = (on) => {
on('task', require('@cypress/code-coverage/task'));
on('file:preprocessor', require('@cypress/code-coverage/use-browserify-istanbul'));
};
cypress / support / index.js:
import './commands'
import '@cypress/code-coverage/support';
测试chrome devtool:
window.__coverage__ // undefined
标准输出:
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句