首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏深入浅出区块链技术

    Istanbul BFT解读(中)

    Istanbul BFT实战 前端时间写了Istanbul BFT的一些原理,以及逻辑详情[1]。今天想写一篇实战的技术文章,所以底层原理就不赘述。 下一篇我们将介绍Istanbul BFT的信息存储。 1、构建节点身份参数,以及创始区块 下载并编译istanbul-tools工具 // 参考文档https://github.com/getamis/istanbul-tools git clone https ://github.com/getamis/istanbul-tools.git cd /Path/to/your/istanbul-tools/ make istanbul 利用istanbul-tools 5.2 去除validator istanbul.propose("newValidatorAdd", false) 具体查看方式,参考上一步。

    72220发布于 2020-09-24
  • 来自专栏IMWeb前端团队

    代码覆盖率工具 istanbul

    代码覆盖率工具 istanbul 1. 代码覆盖率 在测试时,我们的用例把所有代码都覆盖了吗? istanbul 是一个代码覆盖工具 它可以帮助我们检查代码的覆盖率 在一个项目中,可以通过 istanbul 设定某些覆盖率阈值来保证测试用例的齐全完整程度,用来保证代码质量 下面是对 istanbul 安装 需要安装 mocha,should,istanbul $ npm install mocha $ npm install should $ npm install istanbul mocha 是测试框架 \node_modules\.bin\istanbul cover . \node_modules\.bin\istanbul cover .

    1.8K50发布于 2017-12-29
  • 来自专栏IMWeb前端团队

    代码覆盖率工具 istanbul

    istanbul 是一个代码覆盖工具 它可以帮助我们检查代码的覆盖率 在一个项目中,可以通过 istanbul 设定某些覆盖率阈值来保证测试用例的齐全完整程度,用来保证代码质量 下面是对 istanbul 安装 需要安装 mocha,should,istanbul $ npm install mocha $ npm install should $ npm install istanbul mocha 是测试框架 \node_modules\.bin\istanbul cover . 所在的进程)执行测试,只有这样, istanbul 才会捕捉到覆盖率数据。 \node_modules\.bin\istanbul cover .

    2.1K21发布于 2019-12-05
  • 来自专栏阮一峰的网络日志

    代码覆盖率工具 Istanbul 入门教程

    一、安装 Istanbul 是一个 npm 模块,安装非常简单,就一行命令。 $ npm install -g istanbul 二、覆盖率测试 来看一个例子,怎么使用 Istanbul 。 $ istanbul cover _mocha // or $ istanbul cover _mocha test/test.sqrt.js sqrt ✓ 4的平方根应该等于2 因为,mocha 和 _mocha 是两个不同的命令,前者会新建一个进程执行测试,而后者是在当前进程(即 istanbul 所在的进程)执行测试,只有这样, istanbul 才会捕捉到覆盖率数据。 如果不加那两根连词线,它们就会被当作 istanbul 的参数(参考链接1,2)。 如果想在浏览器运行 Istanbul ,可以参考这篇文章。 五、忽略某些代码 istanbul 提供注释语法,允许某些代码不计入覆盖率。

    1.6K41发布于 2018-04-12
  • 来自专栏杰的记事本

    代码覆盖率 Istanbul的简单使用

    一、安装 Istanbul 是一个 npm 模块,安装非常简单,就一行命令。 $ npm install -g istanbul 二、覆盖率测试 来看一个例子,怎么使用 Istanbul 。 $ istanbul cover _mocha // or $ istanbul cover _mocha test/test.sqrt.js sqrt ✓ 4的平方根应该等于2 因为,mocha 和 _mocha 是两个不同的命令,前者会新建一个进程执行测试,而后者是在当前进程(即 istanbul 所在的进程)执行测试,只有这样, istanbul 才会捕捉到覆盖率数据。 如果不加那两根连词线,它们就会被当作 istanbul 的参数(参考链接1,2)。 如果想在浏览器运行 Istanbul ,可以参考这篇文章。 五、忽略某些代码 istanbul 提供注释语法,允许某些代码不计入覆盖率。

    1.8K20发布于 2019-09-04
  • 来自专栏用户6296428的专栏

    前端精准测试探索:覆盖率实时统计工具

    一、技术选型 首先,覆盖率收集的前提,需要完成代码插桩工作,插桩方法来自于两个开源覆盖率统计框架,istanbul.js以及istanbul-middleware (以下称im),提供了若干个插桩方法, 而 im 其实也是在 istanbul.js 的基础上做了封装, 能力来自于 istanbul-lib-instrument 所有的插桩方法,大致分为两种类型: 运行前插桩 运行时插桩 1.1 运行前插桩 babel-plugin-istanbul istanbul提供的babel插件 , 能够在代码编译打包阶段直接植入插桩代码。适用于使用babel的前端工程,基于react和vue的工程都可以。 Node端:依赖istanbuljs提供的能力 - istanbul-lib-hook 、istanbul-lib-instrument 重写istanbulMiddleware.hookLoader方法 覆盖率服务端 继承istanbul middleware的功能 支持分支维度接收和查询覆盖率 代码变更时覆盖率替换, 支持存储和查看历史版本 主要基于istanbul-middleware做了二次开发

    2.4K31发布于 2020-08-25
  • 来自专栏数据科学和人工智能

    数据集 | 全球死亡率数据集(2015-2021)

    数据预览 country_name local_unit_name year time deaths time_unit 231 Turkey Istanbul City 2017 9 1473 627 Pakistan Karachi City 2019 11 1807 311 Turkey Istanbul City 2018 37 1266 378 Turkey Istanbul City 2019 52 1540 601 Indonesia Jakarta Province 2015 9 4548 136 Turkey Istanbul City 2015 19 1368 12 China Wuhan City 2020 7 666 6 China Wuhan City 2020 4 614 138 Turkey Istanbul City 2015 21 1262 100 Belarus Mogilev

    1.5K30编辑于 2022-03-30
  • 来自专栏知识技能

    Karma单元测试reload异常处理

    For all other cases, the Swiss army knife /* istanbul ignore next */ may be used which skips the "next logical expression in which case that part of the expression is ignored for branch coverage那么直接用/* istanbul 所以封装一个函数/* istanbul ignore next */export const locationReload = () => { /* istanbul ignore next */

    59630编辑于 2023-02-10
  • 来自专栏前端自习课

    【Web技术】981- 手摸手之前端覆盖率实践

    来源:i.m.t https://juejin.cn/post/6959147556295180324 前述 今天开一个新坑,讲讲前端覆盖率:Istanbul。 这篇文章,将讲述如何使用 Istanbul 去收集前端覆盖率、对源码的解析、如何贴合业务理解对源码做相应的修改、覆盖率一键上报等。 代码覆盖率获取探索 覆盖率实时统计工具 以及相关的GitHub开源: babel-plugin-istanbul istanbul-middleware nyc code-coverage 好了,搬好小板凳 (原谅我如此不要脸...嘤嘤嘤) 运行前插桩 nyc instrument 针对编译之后的JS文件 , 进行手动插桩 , 形成插桩后的新JS文件 babel-plugin-istanbul istanbul 类似,区别在于该方法是在浏览器请求js时才会返回插桩代码,是一个动态过程 babel-plugin-istanbul 最上面,我讲到如果项目是用 vue 或者 React 的,可以直接使用插件 babel-plugin-istanbul

    1.6K20发布于 2021-06-24
  • 来自专栏女程序员的日常_Lin

    vue源码解读(二)

    _uid = uid++ let startTag, endTag /* istanbul ignore if */ if (process.env.NODE_ENV ! : boolean ): Component { el = el && query(el) /* istanbul ignore if */ // 对el进行了限制,vue不能挂在在body if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm. _update(vnode,hydrating); let updateComponent /* istanbul ignore if */ if (process.env.NODE_ENV

    87321发布于 2019-07-19
  • 来自专栏前端开发面经

    Vue组件是怎样挂载的_2023-02-27

    : boolean ): Component { el = el && query(el) /* istanbul ignore if */ /** * 挂载对象不能为body和html if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm. } } // 检测完render后,开始调用beforeMount声明周期 callHook(vm, 'beforeMount') let updateComponent /* istanbul render result, // or previous vnode to prevent render error causing blank component /* istanbul

    52620编辑于 2023-02-27
  • 来自专栏前端到底怎么学好来

    你想要的——vue源码分析(2)

    _uid = uid++ let startTag, endTag /* istanbul ignore if */ if (process.env.NODE_ENV ! resolveConstructorOptions(vm.constructor), options || {}, vm ) } /* istanbul props // 至此,所有数据的初始化工作已经做完,所有触发created钩子,在这个钩子的回调中可以访问之前所定义的所有数据 callHook(vm, 'created') /* istanbul ) { if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm.

    31610编辑于 2023-11-30
  • 来自专栏Vue中文社区

    面试官:Vue实例挂载的过程中发生了什么?

    _uid = uid++ let startTag, endTag /* istanbul ignore if */ if (process.env.NODE_ENV ! : boolean ): Component { // 获取或查询元素 el = el && query(el) /* istanbul ignore if */ // vue 不允许直接挂载到 if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul if (el) { // 通过选择器获取元素内容 template = getOuterHTML(el) } if (template) { /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm.

    1.7K10发布于 2021-02-26
  • 来自专栏前端开发面经

    Vue组件是怎样挂载的

    : boolean): Component { el = el && query(el) /* istanbul ignore if */ /** * 挂载对象不能为body和html标签 ) { if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul return this } } else if (el) { template = getOuterHTML(el) } if (template) { /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm. error render result, // or previous vnode to prevent render error causing blank component /* istanbul

    73020编辑于 2022-10-19
  • 来自专栏云前端

    [译] Vue 应用的代码覆盖率

    babel-plugin-istanbul 。 让我们来告诉 babel-plugin-istanbul 我们想要同时测量 .js 和 .vue 文件吧。 ', { extension: ['.js', '.vue'] }] ] } 提示: 我们可以将 istanbul 设置放在一个单独的 .nycrc 文件中(译注:? nyc ,Istanbul 提供的命令行接口工具),或将它们添加到 package.json。目前而言,还是先将这些设置一起保留在插件列表本身中吧。 向插件列表中添加 babel-plugin-istanbul 就能在 window.__coverage__ 对象中获知代码覆盖率信息。

    3.7K10发布于 2020-09-16
  • 来自专栏神光的编程秘籍

    手写一个简易版 Jest

    其实这个不是 jest 自己实现的,它是用的 istanbulistanbul 实现覆盖率检测是通过 AST 给函数加入一些埋点代码,也叫函数插桩。 = require('babel-plugin-istanbul'); const res = babel.transformFileSync('. 这里需要用到 istanbul-lib-report 和 istanbul-lib-coverage 这俩包: 代码直接用文档中的实例代码就行。 '); const reports = require('istanbul-reports'); var libCoverage = require('istanbul-lib-coverage'); 比如覆盖率检测,这个直接用 istanbul 就行,它是通过函数插桩拿到覆盖率数据,放在一个 __corverage__ 的全局变量上,然后用别的包把它打印出来就行。

    79110编辑于 2024-01-02
  • 来自专栏老马寒门IT

    Node入门教程(13)第十一章:mocha单元测试+should断言库+istanbul覆盖率测试+art-template

    Istanbul 是 JavaScript 程序的代码覆盖率工具 安装 $ npm install -g istanbul 覆盖率测试 demo $ istanbul cover simple.js 配合 mocha 测试覆盖率统计 $ istanbul cover _mocha 上面命令中,istanbul cover 命令后面跟的是 _mocha 命令,前面的下划线是不能省略的。 因为,mocha 和 _mocha 是两个不同的命令,前者会新建一个进程执行测试,而后者是在当前进程(即 istanbul 所在的进程)执行测试,只有这样, istanbul 才会捕捉到覆盖率数据。 $ istanbul cover _mocha -- tests/test.sqrt.js -R spec 上面命令中,两根连词线后面的部分,都会被当作参数传入 Mocha 。 如果不加那两根连词线,它们就会被当作 istanbul 的参数

    82400发布于 2018-07-31
  • 来自专栏藏经阁

    【Vue 源码解析】Vue实例挂载过程

    _uid = uid++ let startTag, endTag /* istanbul ignore if */ if (process.env.NODE_ENV ! : boolean ): Component { // 获取或查询元素 el = el && query(el) /* istanbul ignore if */ // vue 不允许直接挂载到 if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul if (el) { // 通过选择器获取元素内容 template = getOuterHTML(el) } if (template) { /* istanbul == 'production') { /* istanbul ignore if */ if ((vm.$options.template && vm.

    1K30编辑于 2023-03-19
  • 来自专栏数据科学和人工智能

    数据集 | 网上购物者购买意图数据集数据集

    Computer Engineering, Faculty of Engineering and Natural Sciences, Bahcesehir University, 34349 Besiktas, Istanbul Yomi Kastro Inveon Information Technologies Consultancy and Trade, 34335 Istanbul, Turkey 5.

    1.9K10编辑于 2022-03-30
  • 来自专栏前端到底怎么学好来

    你想要的——vue源码分析(1)

    ', { get: isServerRendering})Object.defineProperty(Vue.prototype, '$ssrContext', { get () { /* istanbul query(el) : undefined return mountComponent(this, el, hydrating)}// devtools global hook/* istanbul : boolean): Component { el = el && query(el) /* istanbul ignore if */ if (el === document.body || ) { if (template.charAt(0) === '#') { template = idToTemplate(template) /* istanbul return this } } else if (el) { template = getOuterHTML(el) } if (template) { /* istanbul

    32110编辑于 2023-11-30
领券