Skip to content

Tests fail with Angularfire #14280

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

Closed
chrste90 opened this issue Apr 26, 2019 · 9 comments · Fixed by #14334
Closed

Tests fail with Angularfire #14280

chrste90 opened this issue Apr 26, 2019 · 9 comments · Fixed by #14334

Comments

@chrste90
Copy link

chrste90 commented Apr 26, 2019

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Maybe

Description

When i run ng test i get Executed 0 of 0 ERROR

🔬 Minimal Reproduction

ng new TestApp --defaults
cd TestApp/
npm install --save @angular/fire firebase

Replace content of app.component.ts with

import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'TestApp';

  constructor(private afAuth: AngularFireAuth) {
  }
}

and run ng test

🔥 Exception or Error




Executed 0 of 0 ERROR 

🌍 Your Environment




Angular CLI: 8.0.0-rc.0
Node: 10.15.2
OS: darwin x64
Angular: 8.0.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0-rc.0
@angular-devkit/build-angular     0.800.0-rc.0
@angular-devkit/build-optimizer   0.800.0-rc.0
@angular-devkit/build-webpack     0.800.0-rc.0
@angular-devkit/core              8.0.0-rc.0
@angular-devkit/schematics        8.0.0-rc.0
@angular/fire                     5.1.2
@ngtools/webpack                  8.0.0-rc.0
@schematics/angular               8.0.0-rc.0
@schematics/update                0.800.0-rc.0
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

@filipesilva
Copy link
Contributor

I think we have some errors being swallowed somewhere.

@filipesilva filipesilva modified the milestones: Backlog, 8.0 May 2, 2019
@filipesilva filipesilva self-assigned this May 3, 2019
@filipesilva
Copy link
Contributor

Interesting, as far as I can tell something breaks mysteriously as soon as AngularFireAuth is included in the compilation. It's enough to add this to app.component.ts for instance:

import { AngularFireAuth } from '@angular/fire/auth';
console.log(AngularFireAuth)

It doesn't affect ng serve though. So it's probably not related to the compilation proper, but rather something about the karma/jasmine runtime.

@filipesilva
Copy link
Contributor

So this is a fun one. The above is enough to see it on a 8 RC project.

But not on a new 7.0 project. Not even when the 7.0 project is updated to 8. In fact, it's not reproducible even after replacing every file in the 7 project with the 8 repro.

At that point removing the package-lock.json and node modules, then reinstalling will indeed reproduce it.

So it seems that it's something on an indirect loose, or hoisted, dependency.

@chrste90
Copy link
Author

chrste90 commented May 3, 2019

Ah good to know, this explains why the error occured only last week and not directly after updating to CLI 8.

Any idea how we can find the root cause for this strange behaviour?

@filipesilva
Copy link
Contributor

I don't have a super good way to figure this out to be honest. Mostly trying to change dependencies and isolate where the problem came up.

@filipesilva
Copy link
Contributor

It seems to happen with firebase@>5.10.0. Pinning to [email protected] is a good workaround for now.

@filipesilva
Copy link
Contributor

#14334 should fix it. It seems like firebase might be doing something with polyfills starting on that version, and we were erroneously splitting polyfill chunks as well.

@chrste90
Copy link
Author

chrste90 commented May 8, 2019

Thank you very much for the quick fix @filipesilva
Everything is working again.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.