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 摘要。