【问题标题】:Documentation Coverage Compodoc and Angular文档覆盖 Compodoc 和 Angular
【发布时间】:2022-01-03 18:30:21
【问题描述】:

正如标题所说,我正在将 compodoc 与 Angular 一起使用,到目前为止它运行良好。

我的问题在于代码覆盖率的计算。 有没有办法修改这个计算? 如果我认为它们是不言自明的,我不想记录每个变量的含义。而且我不希望我的代码中有一百万个@ignores,因为我认为它的可读性会降低。

此外,我很想知道,是否有办法显示我所缺少的。例如, compodoc says i have a low code coverage 但是当我查看我的代码时,我不知道我还能记录什么...

我错过了什么?

import { Component } 

from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';

/**
 * @description snackbar component can be used to alert the user of some circumstance
 * @class SnackbarComponent
 */
@Component({
  selector: 'app-snackbar',
  templateUrl: './snackbar.component.html',
  styleUrls: ['./snackbar.component.scss']
})



export class SnackbarComponent {

  /**
   * @description default class of Snackbarcomponent
   * @memberof SnackbarComponent
   */
  timeOut = 5000;



  /**
   * Creates an instance of SnackbarComponent.
   * @param {MatSnackBar} snackBar
   * @memberof SnackbarComponent
   */
  constructor(
    public snackBar: MatSnackBar
  ) { }


  /**
   * @description takes parameters and opens a small snackbar at the bottom right of the screen
   *
   * @param {string} message text of message
   * @param {string} [className=null] color of Snackbar e.g. "red-snackbar" "green-snackbar"
   * @param {string} [action=" "] Buttontext of Snackbar
   * @return {*}  In either case, a MatSnackBarRef is returned. This can be used to dismiss the snackbar or to receive notification of when the snackbar is dismissed
   * @memberof SnackbarComponent
   * 
   * @example:
   * let snackbarRef = openSnackBar("Hello World", "Accept", "green-snackbar")
   */
  openSnackBar(message: string, className: string = null, action: string = " ") {
    return this.snackBar.open(message, action, {
      duration: this.timeOut,
      verticalPosition: 'bottom',
      horizontalPosition: 'end',
      panelClass: [className],
    });
  }
}

`

【问题讨论】:

    标签: angular typescript code-coverage documentation compodoc


    【解决方案1】:

    作为一个提示给所有与同样问题作斗争的人:

    我发现compodoc 不喜欢@description 标签。只需将您的描述写成没有显式标记的普通文本即可。

    【讨论】:

      猜你喜欢
      • 2019-03-27
      • 1970-01-01
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-25
      • 1970-01-01
      相关资源
      最近更新 更多