-
-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--all
does not include .ts
files that use typecasting
#679
Comments
@nddeluca If you're using something like |
I had the vary same problem and solved it moving the require of Maybe it should be documented or if it's already then it should be easier to find. |
I'm using tape with typescript and have this same problem. If I move the This is the same error as in #504. Actually in that issue, the solution is to move |
I found a solution to my problem above. It is to put {
"all": true,
"include": ["src/*"],
"exclude": ["src/index.ts", "**/*.d.ts"],
"extension": [".ts"],
"reporter": ["html", "lcov", "text"],
"sourceMap": true,
"require": ["ts-node/register"]
} |
@jonaskello how to include custom types when using
declare const DEBUG: boolean;
if (DEBUG) {
console.log('debug');
} It will throw an error Solution: Use |
I've updated the TS tutorial that had some of the tips in here, with some of the newer tips. If you are able, please contribute to those docs :) https://github.com/istanbuljs/istanbuljs.github.io |
This one stumped me for a while on a typescript code base I added coverage too. I wasn't seeing all my source files being included when using
--all
, and narrowed it down to files that use the<T>
oras T
typecasting syntax. Seemed a bit strange, but I was able to set up a new repository and observe the issue in isolation (see below).Note: This is only when using the
-all
flag. If one of the files that is affected is included in a test, then it shows up in the coverage report. Also, the typescript generic syntax (ex.function<T>()
) does not have this issue either, so I don't believe it's related to the appearance of the brackets.Expected Behavior
--all
should include all.ts
filesObserved Behavior
--all
does not include.ts
files that use typecastingBonus Points! Code (or Repository) that Reproduces Issue
See https://github.com/nddeluca/nyc-ts-test.
You can clone,
npm install
, andnpm test
to observe the issue.There are three example
.ts
files nameda
,b
, andc
.a
gets included in the coverage reportb
andc
both use typecasting and get ignored.If you edit the code and remove the typecasting, the files will show up in the coverage.
Forensic Information
Operating System: the operating system you observed the issue on.
Darwin Kernel Version 16.3.0
Environment Information: information about your project's environment, see instructions below:
Node 8.4.0
NPM 5.3.0
Typescript 2.4.2
The text was updated successfully, but these errors were encountered: