Skip to content

Error encountered resolving symbol values statically when using a provider factory #7146

Description

@mildfuzz

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.2.4
node: 7.2.1
os: darwin x64
@angular/animations: 4.3.1
@angular/common: 4.3.1
@angular/compiler: 4.3.1
@angular/core: 4.3.1
@angular/forms: 4.3.1
@angular/http: 4.3.1
@angular/platform-browser: 4.3.1
@angular/platform-browser-dynamic: 4.3.1
@angular/router: 4.3.1
@angular/cli: 1.2.4
@angular/compiler-cli: 4.3.1
@angular/language-service: 4.3.1

Repro steps.

clone this repo:
https://github.com/mildfuzz/testProviderIssues
run ng test --single-run

The log given by the failure.

Error: Error encountered resolving symbol values statically. Calling function 'Test', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol TestProvider in /Users/john/Workspace/testProviderFactory/src/app/test.ts, resolving symbol TestProvider in /Users/john/Workspace/testProviderFactory/src/app/test.ts, resolving symbol AppModule in /Users/john/Workspace/testProviderFactory/src/app/app.module.ts, resolving symbol AppModule in /Users/john/Workspace/testProviderFactory/src/app/app.module.ts
at Compiler.compiler.plugin (/Users/john/Workspace/testProviderFactory/node_modules/@angular/cli/plugins/karma-webpack-throw-error.js:10:23)
at Compiler.applyPlugins (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:61:14)
at Watching._done (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compiler.js:92:17)
at onCompiled (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compiler.js:51:17)
at /Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compiler.js:494:13
at next (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:184:11)
at Compiler. (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/CachePlugin.js:62:5)
at Compiler.applyPluginsAsyncSeries (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:188:13)
at /Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compiler.js:491:10
at Compilation.applyPluginsAsyncSeries (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:177:46)
at self.applyPluginsAsync.err (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compilation.js:645:19)
at next (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:184:11)
at Compilation.compilation.plugin (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/ProgressPlugin.js:121:6)
at Compilation.applyPluginsAsyncSeries (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:188:13)
at self.applyPluginsAsync.err (/Users/john/Workspace/testProviderFactory/node_modules/webpack/lib/Compilation.js:636:11)
at next (/Users/john/Workspace/testProviderFactory/node_modules/tapable/lib/Tapable.js:184:11)

Desired functionality.

builds / tests pass successfully when using a provider factory

I require the ability to use a provider factory that still works with constructor based injection

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: investigationRequires some digging to determine if action is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions