Skip to content

CLI should set "sourceMap": true in "test" task #13093

Closed
@rmorrise

Description

@rmorrise

Bug Report or Feature Request (mark with an x)

- [x] feature request

Command (mark with an x)

- [x] new
- [x] update

Versions

D:\temp>node --version
v8.11.2

D:\temp>npm --version
5.6.0

D:\temp>ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.7
Node: 8.11.2
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.7
@angular-devkit/core         0.6.7
@angular-devkit/schematics   0.6.7
@schematics/angular          0.6.7
@schematics/update           0.6.7
rxjs                         6.2.0
typescript                   2.7.2

OS: Windows 7

Repro steps

  1. ng new foo
  2. Open angular.json and check the settings for projects > foo > architect > test

The log given by the failure

        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }

Desired functionality

        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "sourceMap": true      // <--- This setting should be included by default
          }

Mention any other details that might be useful

When this setting is not included in the project, ng test --code-coverage produces incorrect coverage reporting for the Angular project. The sourceMap setting must be added to the CLI settings to get correct coverage reporting.

Please include this setting in all new projects generated by the CLI.

When using the CLI to upgrade to a new angular version, if this setting is not explicitly set in angular.json, the setting should be added.

Please update the CLI so that it sets the right config out of the box.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions