plantain-00/type-coverage

type-coverage -p command yielding different results from different root directories

Closed this issue · 8 comments

Version(if relevant): 1.0.0

Environment(if relevant):

Vs code , React Typescript based project

Code(if relevant):

// code here

Expected:

I have a packages folder where there are different packages whose type-coverage rate I want to calculate. There is a package named "board" and another package named "proto".

I am testing the type-coverage commands on these two terminals.
In Terminal 1 , I am in >> src/packages/
In Terminal 2 , I am in >> src/packages/proto

Command I run on Terminal 1 : type-coverage -p board
Command I run on Terminal 2 : type-coverage -p ../board

I must get the same type coverage rate in bot the terminals.

Actual:

On Terminal 1 I get >> 396027/40714, 97.27 %
On Terminal 2 I get >> 608/662. 91.84 %

Am I missing something here as the type-coverage command is installed globally.

The result in files start with .. will be ignored, to fix #42 :

if (file.startsWith('..')) {
continue
}

I want to run type-coverage commands from script file of a directory named type-coverage present in the script directory. and script folder is there in the root of the project. do you suggest something that I can do?

The result in files start with .. will be ignored, to fix #42 :

if (file.startsWith('..')) {
continue
}

Maybe your script can be like something cd .. && type-coverage -p ./src

My issue got resolved, I had to change my cwd in the script file. But please look into this that the command not working when I cd into a particular package of the packages directory , and then run type-coverage -p . Even this yielding a different answer.

v2.26.0 add --not-only-in-cwd to disable this behavior.

Okay thanks!