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

Object with a property called 'version' causes problems in testing #2540

Closed
LMFinney opened this issue Oct 6, 2016 · 7 comments
Closed

Object with a property called 'version' causes problems in testing #2540

LMFinney opened this issue Oct 6, 2016 · 7 comments

Comments

@LMFinney
Copy link

LMFinney commented Oct 6, 2016

Please provide us with the following information:

OS?

Windows 7

Versions.

angular-cli: 1.0.0-beta.16
node: 6.6.0
os: win32 x64

Repro steps.

  • Create a new CLI project from scratch.
  • Add the following to app.component.ts:
  constructor() {
    console.log('Handle1', {id: 123, version: 4});
    console.log('Handle2', {id: 123, verion: 4});
  }
  • run ng test
  • You'll see that the second console logging statement prints, but the first doesn't.

The log given by the failure.

No logging - that's the problem.

Mention any other details that might be useful.

The original manifestation of this problem was that I put an object that looks like one of the objects above in an Immutable.js List, but then almost all of the methods on the List failed (i.e. console.log(list.toArray()) never printed). Eventually, I was able to reproduce it in the simpler form that seemingly just the word "version" as a property name caused problems.

This has happened on two machines, one using the chrome launcher and one using the firefox launcher. I don't see the problem by trying to log a similar object literal in the node REPL, the Chrome console, or the Firefox console.

I don't have the problem running the application in the browser - just in the karma test.

@RoopeHakulinen
Copy link
Contributor

I don't think this is an issue with Angular CLI. Angular CLI will simply trigger the Karma and this error is even reproducible without usage of ng test using plain Karma. Please report this to the Karma if there isn't an issue about it yet.

@LMFinney
Copy link
Author

LMFinney commented Oct 7, 2016

I don't think @RoopeHakulinen is correct. I get different results running ng test vs karma start:

C:\sandbox\cli>karma start
07 10 2016 12:15:27.873:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
07 10 2016 12:15:27.883:INFO [launcher]: Starting browser Chrome
07 10 2016 12:15:29.236:INFO [Chrome 53.0.2785 (Windows 7 0.0.0)]: Connected on socket /#dKPeJs-yj1QnM1t8AAAA with id 97416767
LOG: 'Handle1', Object{id: 123, version: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 0 of 3 SUCCESS (0 secs / 0 secs)
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 0 of 3 SUCCESS (0 secs / 0 secs)
LOG: 'Handle1', Object{id: 123, version: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 1 of 3 SUCCESS (0 secs / 0.087 secs)
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 1 of 3 SUCCESS (0 secs / 0.087 secs)
LOG: 'Handle1', Object{id: 123, version: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 2 of 3 SUCCESS (0 secs / 0.127 secs)
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 2 of 3 SUCCESS (0 secs / 0.127 secs)
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 3 of 3 SUCCESS (0.186 secs / 0.17 secs)

C:\sandbox\cli>ng test
07 10 2016 12:15:45.681:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
07 10 2016 12:15:45.686:INFO [launcher]: Starting browser Chrome
07 10 2016 12:15:47.128:INFO [Chrome 53.0.2785 (Windows 7 0.0.0)]: Connected on socket /#99qD4KtjnIPACRNaAAAA with id 11008890
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 0 of 3 SUCCESS (0 secs / 0 secs)
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 1 of 3 SUCCESS (0 secs / 0.092 secs)
LOG: 'Handle2', Object{id: 123, verion: 4}
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 2 of 3 SUCCESS (0 secs / 0.136 secs)
Chrome 53.0.2785 (Windows 7 0.0.0): Executed 3 of 3 SUCCESS (0.195 secs / 0.178 secs)

Notice that Handle2 is displayed in both runs, but Handle1 does not appear for ng test. I made no changes to code or configuration between these runs.

It looks to me like karma has no problem with this, but ng test does.

@RoopeHakulinen
Copy link
Contributor

@LMFinney Seems that it was my mistake. I ran the tests again, and now it produces the same result for me. So you are right and this seems like a legit problem. I'll take a look at what happens on the execution.

@LMFinney
Copy link
Author

LMFinney commented Oct 8, 2016

Thanks!

On Oct 8, 2016 5:25 AM, "Roope Hakulinen" [email protected] wrote:

@LMFinney https://github.com/LMFinney Seems that it was my mistake. I
ran the tests again, and now it produces the same result for me. So you are
right and this seems like a legit problem. I'll take a look at what happens
on the execution.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2540 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGX8Y_Pz5RGEB-4KEPp1HsDDwhIjbsypks5qx2-TgaJpZM4KPe12
.

@filipesilva
Copy link
Contributor

Whoa that's weird. I just tried it with the console logs outside of the constructor, just in src/app/app.component.ts, and could repro on ng test (but not on ng serve).

@filipesilva
Copy link
Contributor

filipesilva commented Oct 10, 2016

Even weirder... those console.log appear on the karma debugger:
image

Edit: also on the plain karma window, for that matter:
image

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 10, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 10, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 15, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 15, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 15, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
Brocco pushed a commit that referenced this issue Oct 19, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix #2540
Close #2627
kieronqtran pushed a commit to kieronqtran/angular-cli that referenced this issue Oct 21, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
Close angular#2627
texel pushed a commit to splice/angular-cli that referenced this issue Nov 3, 2016
This method is more reliable than using regexes on
the input/output streams.

Fix angular#2540
Close angular#2627
@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants