【问题标题】:After angular 14 upgrade - codeCoverage unknown parameter errorangular 14升级后-codeCoverage未知参数错误
【发布时间】:2022-10-20 15:07:27
【问题描述】:

从 angular 13 升级到 14 后,命令 ng test angular-uicomp-lib --codeCoverage=true(其中 angular-uicomp-lib 是要测试的文件夹名称)失败。 收到以下错误:错误:未知参数:codeCoverage

需要知道可以执行哪些操作以使命令成功执行。 TIA。

【问题讨论】:

    标签: angular testing karma-jasmine


    【解决方案1】:

    将 coverage-istanbul 添加到您的记者。 例如:

     reporters: ['progress', 'kjhtml', 'coverage-istanbul'],
    

    【讨论】:

      【解决方案2】:

      您现在必须使用 --code-coverage 而不是 codeCoverage

      Options:
            --help                   Shows a help message for this command in the console.                                                                       [boolean]
        -c, --configuration          One or more named builder configurations as a comma-separated list as specified in the "configurations" section in angular.json.     
                                     The builder uses the named configurations to run the given target.
                                     For more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.                          [string]
            --browsers               Override which browsers tests are run against.                                                                               [string]
            --code-coverage          Output a code coverage report.                                                                             [boolean] [default: false]
            --code-coverage-exclude  Globs to exclude from code coverage.                                                                                          [array]
            --include                Globs of files to include, relative to workspace or project root.
                                     There are 2 special cases:
                                     - when a path to directory is provided, all spec files ending ".spec.@(ts|tsx)" will be included
                                     - when a path to a file is provided, and a matching spec file exists it will be included instead.                             [array]
            --inline-style-language  The stylesheet language to use for the application's inline component styles.
                                                                                                        [string] [choices: "css", "less", "sass", "scss"] [default: "css"]
            --karma-config           The name of the Karma configuration file.                                                                                    [string]
            --main                   The name of the main entry-point file.                                                                                       [string]
            --poll                   Enable and define the file watching poll time period in milliseconds.                                                        [number]
            --polyfills              The name of the polyfills file.                                                                                              [string]
            --preserve-symlinks      Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set.   
                                                                                                                                                                 [boolean]
            --progress               Log progress to the console while building.                                                                 [boolean] [default: true]
            --reporters              Karma reporters to use. Directly passed to the karma runner.                                                                  [array]
            --source-map             Output source maps for scripts and styles. For more information, see
                                     https://angular.io/guide/workspace-config#source-map-configuration.                                         [boolean] [default: true]
            --ts-config              The name of the TypeScript configuration file.                                                                               [string]
            --watch                  Run build when files change.                                                                                                [boolean]
            --web-worker-ts-config   TypeScript configuration for Web Worker modules.                                                                             [string]
      

      【讨论】:

        猜你喜欢
        • 2022-08-17
        • 2022-08-22
        • 1970-01-01
        • 1970-01-01
        • 2019-11-01
        • 1970-01-01
        • 2019-10-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多