Skip to content

Run ng test in prod mode ng test --prod #11606

Closed
@boldwade

Description

@boldwade

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [x] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node: 8.9.4
npm: 6.1.0
ng: 6.0.4

Repro steps

ng test --prod

The log given by the failure

After I realized that I had to add a configuration section in angular.json under test architect node (for which was does not appear to be documented anywhere obvious), here is my config:

          "configurations": {
            "production": {
              "sourceMap": false,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }

When I try to add "aot": true, I get the following error:

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(aot).

Which defeats the purpose of trying to run unit tests in prod mode...

Desired functionality

Runs unit tests with a production version of a build (including AOT) and works

Mention any other details that might be useful

Late at night, I dream of being on a beach with the pleasing sound of lapping waves as I run ng test --prod

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