Skip to content

Commit 37769aa

Browse files
committed
address review comments (instanceof usage on StatementCoverage)
Move declaration of TestCoverageCount before its usage
1 parent fcd1396 commit 37769aa

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

packages/plugin-ext/src/plugin/types-impl.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -3330,6 +3330,11 @@ export class TestMessage implements theia.TestMessage {
33303330
constructor(public message: string | theia.MarkdownString) { }
33313331
}
33323332

3333+
@es5ClassCompat
3334+
export class TestCoverageCount {
3335+
constructor( public covered: number, public total: number) { }
3336+
}
3337+
33333338
@es5ClassCompat
33343339
export class FileCoverage {
33353340

@@ -3341,7 +3346,7 @@ export class FileCoverage {
33413346
const decl = new TestCoverageCount(0, 0);
33423347

33433348
for (const detail of details) {
3344-
if (StatementCoverage.is(detail)) {
3349+
if (detail instanceof StatementCoverage) {
33453350
statements.total += 1;
33463351
statements.covered += detail.executed ? 1 : 0;
33473352

@@ -3380,12 +3385,6 @@ export class StatementCoverage implements theia.StatementCoverage {
33803385
constructor(public executed: number | boolean, public location: Position | Range, public branches: BranchCoverage[] = []) { }
33813386
}
33823387

3383-
export namespace StatementCoverage {
3384-
export function is(coverage: unknown): coverage is StatementCoverage {
3385-
return isObject(coverage) && 'branches' in coverage;
3386-
}
3387-
}
3388-
33893388
export class BranchCoverage implements theia.BranchCoverage {
33903389
constructor(public executed: number | boolean, public location?: Position | Range, public label?: string) { }
33913390
}
@@ -3394,10 +3393,6 @@ export class BranchCoverage implements theia.BranchCoverage {
33943393
export class DeclarationCoverage implements theia.DeclarationCoverage {
33953394
constructor(public name: string, public executed: number | boolean, public location: Position | Range) { }
33963395
}
3397-
@es5ClassCompat
3398-
export class TestCoverageCount implements theia.TestCoverageCount {
3399-
constructor( public covered: number, public total: number) { }
3400-
}
34013396

34023397
export type FileCoverageDetail = StatementCoverage | DeclarationCoverage;
34033398

0 commit comments

Comments
 (0)