NativeScript / NativeScript/nativescript-cli

[dev] Replace istanbul with nyc

未关闭
#4,556 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

technical debt
主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

描述

As the istanbul package is not longer maintained, we need to migrate to nyc.
Currently istanbul doesn't work for the following code:

const { stdio = "inherit" } = options;

In this case grunt test command fails with an exception:

__cov_gCRxMpJElFAq6oDSOHYQNQ.s['1']++;var __awaiter=(__cov_gCRxMpJElFAq6oDSOHYQNQ.b['1'][0]++,this)&&(__cov_gCRxMpJElFAq6oDSOHYQNQ.b['1'][1]++,this.__awaiter)||(__cov_gCRxMpJElFAq6oDSOHYQNQ.b['1'][2]++,function(thisArg,_arguments,P,generator){__cov_gCRxMpJElFAq6oDSOHYQNQ.f['1']++;__cov_gCRxMpJElFAq6oDSOHYQNQ.s['2']++;return new((__cov_gCRxMpJElFAq6oDSOHYQNQ.b['2'][0]++,P)||(__cov_gCRxMpJElFAq6oDSOHYQNQ.b['2'][1]++,P=Promise))(function(resolve,reject){__cov_gCRxMpJElFAq6oDSOHYQNQ.f['2']++;function fulfilled(value){__cov_gCRxMpJElFAq6oDSOHYQNQ.f['3']++;__cov_gCRxMpJElFAq6oDSOHYQNQ.s['4']++;try{__cov_gCRxMpJElFAq6oDSOHYQNQ.s['5']++;step(generator.next(value));}catch(e){__cov_gCRxMpJElFAq6oDSOHYQNQ.s['6']++;reject(e);}}function rejected(value){__cov_gCRxMpJElFAq6oDSOHYQNQ.f['4']++;__cov_gCRxMpJElFAq6oDSOHYQNQ.s['8']++;try{__cov_gCRxMpJElFAq6oDSOHYQNQ.s['9']++;step(generator['throw'](value));}catch(e){__cov_gCRxMpJElFAq6oDSO

SyntaxError: Unexpected token :
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:656:28)
    at Object.Module._extensions.(anonymous function) [as .js] (/Users/havaluova/Work3/nativescript-cli/node_modules/istanbul/lib/hook.js:107:24)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)

It seems that when the above mentioned error occurs, istanbul exits with status code 0 and this is the reason why jenkins build doesn't fail in such situation.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

grunt test 命令开始,找到 CLI 使用的 Istanbul 依赖项和 coverage 配置。检查 Jenkins 构建如何接收测试失败,并根据当前会触发语法错误的 destructuring 示例验证迁移。完成的标准是测试使用 nyc 运行,并且 coverage 错误产生非零状态。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
cli, testing-qa
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。