Skip to content

Better control over sourcemap generation for test #18060

@StefanKern

Description

@StefanKern

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

Currently the karama schema definition allows the following options for generating souremaps.

export declare type SourceMapUnion = boolean | SourceMapClass;
export interface SourceMapClass {
    /**
     * Output sourcemaps for all scripts.
     */
    scripts?: boolean;
    /**
     * Output sourcemaps for all styles.
     */
    styles?: boolean;
    /**
     * Resolve vendor packages sourcemaps.
     */
    vendor?: boolean;
}

however the option for vendor is highly misleading, because setting it to true, actually disables the sourcemaps for all unit tests, See screenshot:
grafik

Since we have a very large application, where the unminified test files are very, very large, this slows down the testing significantly. (the vendor.js has a total of 36MB in its unminified state, 15 without sourcemaps).

Describe the solution you'd like

A more fine granular solution to control the souremap generation for unit tests would be helpful. I suggest defining them like this:

export declare type SourceMapUnion = boolean | SourceMapClass;
export interface SourceMapClass {
    /**
     * Output sourcemaps for all scripts.
     */
    scripts?: boolean;
    /**
     * Output sourcemaps for all styles.
     */
    styles?: boolean;
    /**
     * Resolve vendor packages sourcemaps.
     */
    vendor?: boolean;
    /**
     * Resolve application sourcemaps (main.js and all lazyloaded modules).
     */
    application?: boolean;
    /**
     * Resolve test file sourcemaps.
     */
    test?: boolean;
}

Describe alternatives you've considered

I tried modifying the karma.config.js and tsconfig.spec.ts to control the sourcemap generation, but to no avail

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions