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

[QUESTION] - console spy not catching log #1977

Closed
jamessouth opened this issue Feb 13, 2019 · 3 comments
Closed

[QUESTION] - console spy not catching log #1977

jamessouth opened this issue Feb 13, 2019 · 3 comments

Comments

@jamessouth
Copy link

Hello, I posted this question on SO a couple of days ago but no answers yet, and it looks like you have ended the google group. In my node/esm project testing with ava, nyc and sinon I'm not sure why my spy on console.log isn't noticing a log to the console.

  • Sinon version : 7.2.3
  • Environment : node 10.15.1, npm 6.5.0, windows 10
  • Other libraries you are using: esm 3.2.4, nyc 13.2.0, ava 1.2.1

What did you expect to happen?
In another part of my project I have successfully spied on console.log for call counts and args passed and here I expected the same - acknowledgement via callCount that a message was logged to the console.

What actually happens
callCount is 0 instead of 1, notCalled is true

How to reproduce

test repo here

@jamessouth
Copy link
Author

Getting somewhere! The test passes when you comment out the import statement in main, so I guess this has something to do with esm so I will close this for now.

@fatso83
Copy link
Contributor

fatso83 commented Feb 18, 2019

@jamessouth You might find a lot of info on this issue here and on this follow-up on Stackoverflow. The setup is quite similar (ES6, Ava, ESM).

@jamessouth
Copy link
Author

thank you @fatso83 this issue was actually caused by a bug in esm which has since been fixed with the 3.2.5 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants