因果关系覆盖文件夹未存储在.jar文件中

时间:2019-05-27 15:10:19

标签: java angular maven jenkins karma-jasmine

我目前在Angular 7项目中工作,在这里我使用karma /茉莉花进行单元测试,并使用Maven构建项目。

到目前为止,一切正常,但是包含测试报告的覆盖范围顺序未存储在目标文件夹内的通用.jar文件中。

在我的项目文件夹中,coverage文件夹存储在目标/覆盖范围下,但在.jar文件中,该文件夹完全丢失。.

我的karma.conf.js看起来像这样:

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-spec-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '/dist/coverage'), 
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    ...
};

我的pom.xml是这样的

  <profiles>
    <profile>
      <id>smag</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>npm run build</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <arguments>run build</arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    ....

在我的package.json中定义了以下脚本:

  "scripts": {
    "ng": "ng",
    "build": "ng build --prod --base-href=/ui/",
   ...

angular.json内部的配置:

  "configurations": {
    "production": {
      "optimization": true,
      "outputHashing": "all",
      "sourceMap": false,
      "extractCss": true,
      "namedChunks": false,
      "aot": true,
      "extractLicenses": true,
      "vendorChunk": false,
      "buildOptimizer": true,
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.prod.ts"
        }
      ]
    },
    ...

我在做什么错了?

0 个答案:

没有答案