Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

For polyfill es7/reflect, it should be mentioned that tests are not run in AOT mode #408

@fredgate

Description

@fredgate

Bug Report or Feature Request (mark with an x)

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

Area

- [ ] devkit
- [x] schematics

Versions

angular CLI 1.6.4

Repro steps

Use AOT to serve and build the application.

In the polyfills.ts file, comment the import 'core-js/es7/reflect'; line as it is mentioned that :

/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
// import 'core-js/es7/reflect';

Then execute unit tests. Tests where a provider (the system under test, or any other class) has a injected dependency will fail with a message indicating that it can resolve all parameter for the class. It is not because its dependencies are not registered in the testing module, but because it can not read metadata of the class and so determine the dependant classes.

The log given by the failure

Error: Can't resolve all parameters for MyService: (?). in http://localhost:9876/_karma_webpack_/vendor.bundle.js (line 20595)
syntaxError@http://localhost:9876/_karma_webpack_/vendor.bundle.js:20595:34
../../../compiler/esm5/compiler.js/CompileMetadataResolver.prototype._getDependenciesMetadata@http://localhost:9876/_karma_webpack_/vendor.bundle.js:35802:35

Desired functionality

The polyfills.ts should mention for the es7/reflect polyfill that unit tests are not run in AOT mode.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions