NativeScript / NativeScript/nativescript-cli

[dev] Replace istanbul with nyc

Open
#4,556 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

technical debt
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the grunt test command and find the Istanbul dependency and coverage configuration used by the CLI. Check how the Jenkins build receives test failures and verify the migration against the destructuring example that currently triggers a syntax error. Done means tests run with nyc and coverage errors produce a nonzero status.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.