Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not pass the test with newly initiated project #3233

Closed
e-cloud opened this issue Nov 22, 2016 · 2 comments
Closed

Can not pass the test with newly initiated project #3233

e-cloud opened this issue Nov 22, 2016 · 2 comments

Comments

@e-cloud
Copy link
Contributor

e-cloud commented Nov 22, 2016

OS?

Ubuntu 16.10

Versions.

1.0.0-beta.20-4

Repro steps

ng new test --style scss --routing

The log given by the failure.

> test@0.0.0 test /home/cloud/github/group-work/test
> ng test

22 11 2016 19:57:54.048:WARN [karma]: No captured browser, open http://localhost:9876/
22 11 2016 19:57:54.058:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
22 11 2016 19:57:54.058:INFO [launcher]: Launching browser Chrome with unlimited concurrency
22 11 2016 19:57:54.063:INFO [launcher]: Starting browser Chrome
22 11 2016 19:57:55.599:INFO [Chrome 54.0.2840 (Linux 0.0.0)]: Connected on socket /#HIhHWcJftuifTQQ1AAAA with id 1931739
Chrome 54.0.2840 (Linux 0.0.0) AppComponent should create the app FAILED
	'router-outlet' is not a known element:
	1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
	2. If 'router-outlet' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
	  {{title}}
	</h1>
	[ERROR ->]<router-outlet></router-outlet>
	"): AppComponent@3:0
	Error: Template parse errors:
	    at TemplateParser.parse (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/template_parser/template_parser.js:97:0 <- src/test.ts:11121:19)
	    at RuntimeCompiler._compileTemplate (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:255:0 <- src/test.ts:25485:51)
	    at webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:47 <- src/test.ts:25405:62
	    at Set.forEach (native)
	    at RuntimeCompiler._compileComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:0 <- src/test.ts:25405:19)
	    at createResult (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:86:0 <- src/test.ts:25316:19)
	    at RuntimeCompiler._compileModuleAndAllComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:90:0 <- src/test.ts:25320:88)
	    at RuntimeCompiler.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:62:0 <- src/test.ts:25292:21)
	    at TestingCompilerImpl.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/bundles/compiler-testing.umd.js:482:0 <- src/test.ts:37428:35)
	    at TestBed._initIfNeeded (webpack:///home/cloud/github/group-work/test/~/@angular/core/bundles/core-testing.umd.js:758:0 <- src/test.ts:9347:40)
Chrome 54.0.2840 (Linux 0.0.0) AppComponent should have as title 'app works!' FAILED
	'router-outlet' is not a known element:
	1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
	2. If 'router-outlet' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
	  {{title}}
	</h1>
	[ERROR ->]<router-outlet></router-outlet>
	"): AppComponent@3:0
	Error: Template parse errors:
	    at TemplateParser.parse (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/template_parser/template_parser.js:97:0 <- src/test.ts:11121:19)
	    at RuntimeCompiler._compileTemplate (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:255:0 <- src/test.ts:25485:51)
	    at webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:47 <- src/test.ts:25405:62
	    at Set.forEach (native)
	    at RuntimeCompiler._compileComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:0 <- src/test.ts:25405:19)
	    at createResult (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:86:0 <- src/test.ts:25316:19)
	    at RuntimeCompiler._compileModuleAndAllComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:90:0 <- src/test.ts:25320:88)
	    at RuntimeCompiler.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:62:0 <- src/test.ts:25292:21)
	    at TestingCompilerImpl.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/bundles/compiler-testing.umd.js:482:0 <- src/test.ts:37428:35)
	    at TestBed._initIfNeeded (webpack:///home/cloud/github/group-work/test/~/@angular/core/bundles/core-testing.umd.js:758:0 <- src/test.ts:9347:40)
Chrome 54.0.2840 (Linux 0.0.0) AppComponent should render title in a h1 tag FAILED
	'router-outlet' is not a known element:
	1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
	2. If 'router-outlet' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
	  {{title}}
	</h1>
	[ERROR ->]<router-outlet></router-outlet>
	"): AppComponent@3:0
	Error: Template parse errors:
	    at TemplateParser.parse (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/template_parser/template_parser.js:97:0 <- src/test.ts:11121:19)
	    at RuntimeCompiler._compileTemplate (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:255:0 <- src/test.ts:25485:51)
	    at webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:47 <- src/test.ts:25405:62
	    at Set.forEach (native)
	    at RuntimeCompiler._compileComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:175:0 <- src/test.ts:25405:19)
	    at createResult (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:86:0 <- src/test.ts:25316:19)
	    at RuntimeCompiler._compileModuleAndAllComponents (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:90:0 <- src/test.ts:25320:88)
	    at RuntimeCompiler.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/src/runtime_compiler.js:62:0 <- src/test.ts:25292:21)
	    at TestingCompilerImpl.compileModuleAndAllComponentsSync (webpack:///home/cloud/github/group-work/test/~/@angular/compiler/bundles/compiler-testing.umd.js:482:0 <- src/test.ts:37428:35)
	    at TestBed._initIfNeeded (webpack:///home/cloud/github/group-work/test/~/@angular/core/bundles/core-testing.umd.js:758:0 <- src/test.ts:9347:40)
Chrome 54.0.2840 (Linux 0.0.0): Executed 3 of 3 (3 FAILED) ERROR (0.28 secs / 0.163 secs)

Mention any other details that might be useful.

in app.component.spec.ts, the generated code looks like:

describe('AppComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent
      ],
    });
  });
  ...

But the correct one should be:

// import some thing
describe('AppComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        RouterTestingModule.withRoutes([
          { path: '', component: AppComponent }
        ])
      ],
      declarations: [
        AppComponent
      ],
    });
  });
  ...
@jupapios
Copy link

This is already fixed in the current version 1.0.0-beta.22-1 (since 1.0.0-beta.22)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants