Skip to content

[dev] Replace istanbul with nyc #4556

Open
@Fatme

Description

@Fatme

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions