Coverage decreased after upgrading TypeScript to 3.9.x/4.x #1779
-
After switching to the latest typescript version (3.9.x/4.x) I noticed a drop in coverage. It turns out, that in this version typescript introduced a different helper for barrels (index.ts files that export everything from other files in the same directory) and some branches in that helper are not tested, which is why the coverage drops. I submitted an issue to typescript asking the team consider adding an ignore statement to the generated code, but they refused it (microsoft/TypeScript#38975). With that, we have two options:
For typescript v4.x the helpers that we need right now are: var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}; Is there any other option that I'm missing and which could help us move forward without sacrificing coverage? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I would vote for option 2; bit more work but would allow for 100% coverage and newer versions of TS. I don't see any other options |
Beta Was this translation helpful? Give feedback.
-
Seems like we can address this issue by upgrading to Node@14 which retains the coverage at 100%. See #2004. |
Beta Was this translation helpful? Give feedback.
Seems like we can address this issue by upgrading to Node@14 which retains the coverage at 100%. See #2004.