@angular/core/testing has no exported member addProviders

See original GitHub issue

Please provide us with the following information:

  1. OS? Ubuntu 16.04 LTS
  2. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.15
node: 6.5.0
os: linux x64
  1. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.

I created a new Class using the ng g class generator. In this case, it was a class called user, so I got a user.ts and user.spec.ts The generated user.spec.ts had the following content:

/* tslint:disable:no-unused-variable */

import { addProviders, async, inject } from '@angular/core/testing';
import {User} from './user';

describe('User', () => {
  it('should create an instance', () => {
    expect(new User()).toBeTruthy();
  });
});

The addProviders give an error because it doesn’t exist in @angular/core/testing

  1. The log given by the failure. Normally this include a stack trace and some more information.
ERROR in [default] [...]/src/app/core/user/user.spec.ts:3:9 
Module '"[...]/node_modules/@angular/core/testing/index"' has no exported member 'addProviders'.
  1. Mention any other details that might be useful.

Thanks! We’ll be in touch soon.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
deebloocommented, Sep 22, 2016

I just submitted a PR that removes those imports

1reaction
deebloocommented, Sep 22, 2016

The newest version of the cli uses Testbed

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular/core/testing has no exported member ... - Stack Overflow
I want to run my old angular2 unit-test with new RC4 version, but I have a problem.
Read more >
angular/core/testing
Configures and initializes environment for unit testing and provides methods for creating components and services in unit tests. TestComponentRenderer.
Read more >
Errors: has no exported member - Angular - EJ 2 - Syncfusion
Forum Thread - Errors: has no exported member - Angular - EJ 2. ... But you have used version as not active LTS...
Read more >
error ts2305: module '"@angular/core"' has no exported ...
Error: node_modules/ngx-loadable/lib/loadable.service.d.ts:1:43 - error TS2305: Module '"@angular/core"' has no exported member 'NgModuleFactoryLoader'.
Read more >
Document Management - Angular 2 UI Unit Testing - Topcoder
We found out that members from certain countries are restricted from ... This is NOT a new Topcoder policy or something that will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found